forked from jobtrek/22_static_site_team2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Navbar.js
26 lines (26 loc) · 842 Bytes
/
Navbar.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
let pageButtons = document.getElementsByClassName("liststyle");
let burgerButton = document.getElementById("burger");
let userScreen = document.querySelector("body").clientWidth;
document.querySelector("body").onresize = function () {
userScreen = document.querySelector("body").clientWidth;
if (document.documentElement.clientWidth <= 800) {
for (const pagebutton of pageButtons) {
pagebutton.style.display = "none";
}
} else {
for (const pagebutton of pageButtons) {
pagebutton.style.display = "flex";
}
}
};
burgerButton.addEventListener("click", function () {
if (userScreen <= 800) {
for (const pagebutton of pageButtons) {
if (pagebutton.style.display == "flex") {
pagebutton.style.display = "none";
} else {
pagebutton.style.display = "flex";
}
}
}
});