-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
25 lines (21 loc) · 1001 Bytes
/
script.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
document.addEventListener("DOMContentLoaded", function () {
const navLinks = document.querySelectorAll(".nav-js");
const tabContentDivs = document.querySelectorAll("#tab-content > div");
navLinks.forEach((link) => {
link.addEventListener("click", function (event) {
event.preventDefault();
const tabName = this.dataset.tab;
tabContentDivs.forEach((tabContentDiv) => {
if (tabContentDiv.id === `${tabName}-tab-content`) {
tabContentDiv.style.display = "grid";
} else {
tabContentDiv.style.display = "none";
}
});
navLinks.forEach((navLink) => {
navLink.classList.remove("active");
});
this.classList.add("active");
});
});
});