-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
35 lines (29 loc) · 832 Bytes
/
script.js
File metadata and controls
35 lines (29 loc) · 832 Bytes
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
function redirect(url) {
window.location.href = url;
}
function setClass(className, newClass) {
var items = document.getElementsByClassName(className);
for (var i = 0; i < items.length; i++) {
items[i].classList.toggle(newClass);
}
}
const navSlide = () => {
const burger = document.querySelector(".burger");
const nav = document.querySelector(".nav-links");
const navLinks = document.querySelectorAll(".nav-links li");
burger.addEventListener("click", () => {
//Toggle Nave
nav.classList.toggle("nav-active");
//Animate Links
navLinks.forEach((link, index) => {
if (link.style.animation) {
link.style.animation = "";
} else {
link.style.animation = `navLinkFade 0.25s ease forwards ${index / 7 + 0.1}s`;
}
});
//Burger Animation
burger.classList.toggle("toggle");
});
};
navSlide();