-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathscript.js
More file actions
23 lines (17 loc) · 696 Bytes
/
script.js
File metadata and controls
23 lines (17 loc) · 696 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const container = document.querySelector(".container");
document.querySelector(".open-navbar-icon").addEventListener("click", () => {
container.classList.add("change");
});
document.querySelector(".close-navbar-icon").addEventListener("click", () => {
container.classList.remove("change");
});
const colors = ["#6495ed", "#7fffd4", "#ffa07a", "#f08080", "#afeeee"];
let i = 0;
Array.from(document.querySelectorAll(".nav-link")).forEach(item => {
item.style.cssText = `background-color: ${colors[i++]}`;
});
Array.from(document.querySelectorAll(".navigation-button")).forEach(item => {
item.onclick = () => {
item.parentElement.parentElement.classList.toggle("change");
};
});