-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
80 lines (58 loc) · 1.91 KB
/
app.js
File metadata and controls
80 lines (58 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
///////////////////////
//HEADER
////////////////////////
////////////////////////
//FIRST SECTION
////////////////////////
$('.Submit').on('click', (event) => {
event.preventDefault();
// console.log( $('.input-bar').val() );
const locations = $('.input-bar').val();
// let calendar = $(".specific-date").val();
const dateIn = $(".specific-date").val();
$.ajax({
url: `https://api.ipgeolocation.io/astronomy?apiKey=b391913d2c124b18981c98030c6a73c2&location=${locations}&date=${dateIn}`,
}).then((data)=>{
console.log(data);
// console.log($(".specific-date").val());
// calendar.html(data.date)
// console.log($("#specific-date")).clientLeft;
// console.log($('input[type="date"]'))[0];
// console.log(date);
// $('.specific-date').html(data.date);
$('#city').html(data.location.location);
$('#sunrise').html(data.sunrise);
$('#sunset').html(data.sunset);
},
()=>{
console.log('bad request');
});
});
////////////////////////
// CAROUSEL IMAGES
////////////////////////
let currentImgIndex = 0;
let highestIndex = $(".carousel-images").children().length - 1;
$(".next").on("click", () =>{
console.log("Next was clicked");
$(".carousel-images").children().eq(currentImgIndex).css("display", "none");
if (currentImgIndex < highestIndex){
currentImgIndex++;
} else {
currentImgIndex =0;
}
$(".carousel-images").children().eq(currentImgIndex).css("display", "block");
});
$(".previous").on("click", () =>{
console.log("Previous was clicked");
$(".carousel-images").children().eq(currentImgIndex).css("display", "none");
if (currentImgIndex > 0){
currentImgIndex--;
} else {
currentImgIndex = highestIndex;
}
$(".carousel-images").children().eq(currentImgIndex).css("display", "block");
});
////////////////////////
//
////////////////////////