-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathscript.js
More file actions
26 lines (22 loc) · 932 Bytes
/
script.js
File metadata and controls
26 lines (22 loc) · 932 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
document.addEventListener("DOMContentLoaded", () => {
const container = document.querySelector(".container");
const openNavbarIcon = document.querySelector(".open-navbar-icon");
const closeNavbarIcon = document.querySelector(".close-navbar-icon");
const navLinks = document.querySelectorAll(".nav-link");
const navigationButtons = document.querySelectorAll(".navigation-button");
const colors = ["#6495ed", "#7fffd4", "#ffa07a", "#f08080", "#afeeee"];
openNavbarIcon.addEventListener("click", () => {
container.classList.add("change");
});
closeNavbarIcon.addEventListener("click", () => {
container.classList.remove("change");
});
navLinks.forEach((item, index) => {
item.style.backgroundColor = colors[index % colors.length];
});
navigationButtons.forEach(item => {
item.addEventListener("click", () => {
item.closest(".container").classList.toggle("change");
});
});
});