-
Notifications
You must be signed in to change notification settings - Fork 0
/
images.js
95 lines (87 loc) · 2.66 KB
/
images.js
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
let currentindex = 0;
document.addEventListener("DOMContentLoaded", () => {
console.log("I am here");
let slides = document.querySelectorAll(".one");
console.log(slides);
for (let i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}
slides[currentindex].style.display = "flex";
const rbtns = document.querySelectorAll(".right-arrow")
rbtns.forEach(btn => {
btn.addEventListener("click", () => {
console.log(currentindex);
currentindex++;
console.log(currentindex);
for (let i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}
if (currentindex >= slides.length) {
currentindex = 0
}
slides[currentindex].style.display = "flex";
console.log(currentindex);
});
})
const lbtns = document.querySelectorAll(".left-arrow")
lbtns.forEach(btn => {
btn.addEventListener("click", () => {
console.log(currentindex)
currentindex--;
console.log(currentindex)
if (currentindex < 0) {
currentindex = slides.length - 1
}
for (let i = slides.length - 1; i >= 0; i--){
slides[i].style.display = "none";
}
slides[currentindex].style.display = "flex";
console.log(currentindex);
})
})
const divs = document.querySelectorAll(".icon-div");
const tdivs = document.querySelector(".blackout")
const hamburger = document.querySelectorAll(".hbimg")
console.log("Ham clicked!")
console.log(hamburger)
hamburger.forEach(hb => {
hb.addEventListener("click", () => {
hb.style.display = "none"
const img2s = document.querySelectorAll(".firstImage")
img2s.forEach(img2 => {
img2.style.marginTop = "10%"
})
const mobilemenu = document.querySelectorAll(".mobilemenu")
console.log(mobilemenu)
mobilemenu.forEach(menu => {
menu.style.display = "flex";
divs.forEach(div => {
div.style.pointerEvents = "none"
})
tdivs.style.display = "block"
})
})
})
const closeBtns = document.querySelectorAll(".closeButton")
console.log(closeBtns)
closeBtns.forEach(closeBtn => {
closeBtn.addEventListener("click", () => {
const img2s = document.querySelectorAll(".firstImage");
img2s.forEach((img2) => {
img2.style.marginTop = "0%";
})
const mobilemenu = document.querySelectorAll(".mobilemenu");
console.log(mobilemenu);
mobilemenu.forEach((menu) => {
menu.style.display = "none";
divs.forEach((div) => {
div.style.pointerEvents = "auto";
});
hamburger.forEach(hb => {
hb.style.display = "block"
})
tdivs.style.display = "none"
});
})
})
})