-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproject.js
More file actions
30 lines (25 loc) · 796 Bytes
/
project.js
File metadata and controls
30 lines (25 loc) · 796 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
const navbar = document.querySelector(".header .navbar");
const menuButton = document.querySelector(".header .menu");
menuButton.addEventListener("click", () => {
navbar.classList.toggle("show");
menuButton.classList.toggle("rotate");
});
function removeClass() {
menuButton.classList.remove("rotate");
}
document.onscroll = () => {
navbar.classList.remove("show");
menuButton.classList.remove("rotate");
if (window.scrollY > 0) {
document.querySelector(".header").classList.add("active");
} else {
document.querySelector(".header").classList.remove("active");
}
};
document.onload = () => {
if (window.scrollY > 0) {
document.querySelector(".header").classList.add("active");
} else {
document.querySelector(".header").classList.remove("active");
}
};