More progress with getting this mess to work

This commit is contained in:
Jose Stovall 2020-04-04 01:28:15 -04:00
commit 0809d086ee
86 changed files with 1051 additions and 783 deletions

20
Pages/V-Tweaks/index.js Normal file
View 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();
});