-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
40 lines (32 loc) · 1.05 KB
/
script.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
const selectElement = (s) => document.querySelector(s);
const navLinks = document.querySelectorAll(".nav-link");
console.log(navLinks)
selectElement(".menu-icon").addEventListener("click", () => {
selectElement(".nav-list").classList.toggle("active");
navLinks.forEach((link, index) => {
if (link.style.animation) {
link.style.animation = "";
} else {
link.style.animation = `navLinkFade 0.5s ease forwards ${
index / 7 + 0.5
}s`;
console.log(index / 7 + 0.5)
}
});
selectElement(".menu-icon").classList.toggle("toggle");
});
navLinks.forEach((link) => {
link.addEventListener("click", () => {
selectElement(".nav-list").classList.toggle("active");
navLinks.forEach((link, index) => {
if (link.style.animation) {
link.style.animation = "";
} else {
link.style.animation = `navLinkFade 0.5s ease forwards ${
index / 7 + 0.5
}s`;
}
});
selectElement(".menu-icon").classList.toggle("toggle");
});
});