-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.js
45 lines (37 loc) · 1.19 KB
/
index.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
function dropDown() {
var x = document.getElementById("dropdown");
if (x.className === "dropdown") {
x.className += "-active";
} else {
x.className = "dropdown";
}
var y = document.getElementById("hero");
if (y.className === "hero") {
y.className += " dropped";
} else {
y.className = "hero";
}
var z = document.getElementById("icon");
if (z.className === "menu-icon") {
z.innerHTML = "x";
z.className = "cross-icon";
} else {
z.innerHTML = "≡";
z.className = "menu-icon";
}
}
const buttons = document.querySelectorAll(".carousel-button");
buttons.forEach(button => {
button.addEventListener("click", () =>{
const nextSlideNumber = button.dataset.carousel;
const slides = document.querySelectorAll(".carousel-slide");
const activeSlide = document.querySelector("[data-active]");
const activeSlider = document.querySelector("[data-active-slider]")
if(slides[nextSlideNumber - 1].dataset.active == undefined){
button.dataset.activeSlider = true;
slides[nextSlideNumber - 1].dataset.active = true;
delete activeSlider.dataset.activeSlider;
delete activeSlide.dataset.active;
}
});
});