forked from HuXn-WebDev/HTML-CSS-JavaScript-100-Projects
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
22 lines (19 loc) · 660 Bytes
/
app.js
File metadata and controls
22 lines (19 loc) · 660 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
let menu_lis = document.querySelectorAll(".menu_Links ul li");
menu_lis.forEach((li) => {
li.addEventListener("click", (e) => {
document
.querySelectorAll(".menu_Links ul li.active")
.forEach((activeEle) => {
activeEle.classList.remove("active");
});
e.target.classList.add("active");
document.querySelectorAll(".sections > section").forEach((section) => {
if (e.target.textContent === section.dataset.section) {
document.querySelectorAll(".sections .visible").forEach((ele) => {
ele.classList.remove("visible");
});
section.classList.add("visible");
}
});
});
});