More progress with getting this mess to work
This commit is contained in:
parent
e4c9c302a5
commit
0809d086ee
86 changed files with 1051 additions and 783 deletions
20
Pages/V-Tweaks/index.js
Normal file
20
Pages/V-Tweaks/index.js
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
let currentNav = null;
|
||||
|
||||
window.addEventListener("DOMContentLoaded", (evt) => {
|
||||
document.querySelectorAll("nav .item").forEach((navItem) => {
|
||||
navItem.addEventListener("click", () => {
|
||||
// Undo display for the old item
|
||||
if (currentNav !== null) {
|
||||
document.querySelector(`section[for='${currentNav.innerText}']`).classList.remove("shown");
|
||||
currentNav.removeAttribute("active");
|
||||
}
|
||||
|
||||
navItem.setAttribute("active", "");
|
||||
document.querySelector(`section[for='${navItem.innerText}']`).classList.add("shown");
|
||||
currentNav = navItem;
|
||||
});
|
||||
});
|
||||
|
||||
// Click the first nav item
|
||||
document.querySelector("nav .item").click();
|
||||
});
|
||||
Loading…
Reference in a new issue