-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
62 lines (53 loc) · 1.64 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const hamburger_btn = document.getElementById("hammenu");
const hamicon = document.getElementById("icon");
const menuitem = document.getElementById("menuitem");
// menuitem.style.display = "none";
function hamburgerfunction() {
console.log(hamburger_btn, "hamburger_btn");
console.log(hamicon, "hamicon");
// hamburger_btn.addEventListener("click", (event) => {
// console.log("clicked");
if (menuitem.style.display === "none") {
menuitem.style.display = "flex";
console.log(event);
console.log(hamicon);
// if(hamicon.classList)
hamicon.classList.replace("fa-bars", "fa-xmark");
// console.log(hamburger_btn.classList);
// hamburger_btn.children.classList.remove("fa-solid fa-bars");
// hamburger_btn.children.classList.add("fa-solid fa-xmark");
} else {
menuitem.style.display = "none";
hamicon.classList.replace("fa-xmark", "fa-bars");
}
// hamicon.classList.remove();
// hamicon.classList.add("fa-solid fa-xmark");
// });
console.log("Hello");
}
document.addEventListener("DOMContentLoaded", initializeSlide);
const imgs = document.querySelectorAll("img.imgdiv");
console.log(imgs);
let slideindex = 0;
function initializeSlide() {
if (imgs.length > 0) {
imgs[slideindex].classList.add("displayimg");
setInterval(nextslide, 5000);
}
}
function showslide(index) {
if (index >= imgs.length) {
slideindex = 0;
} else if (index < 0) {
slideindex = imgs.length - 1;
}
imgs.forEach((slide) => {
slide.classList.remove("displayimg");
});
imgs[slideindex].classList.add("displayimg");
}
function nextslide() {
slideindex++;
console.log(slideindex);
showslide(slideindex);
}