Files
fedizinefest/scripts/nav.js
Glitch (fedizinefest) 95cc06d7ba 😺💾 Checkpoint
./2024/index.html:69682263/625
./for-artists/index.html:69682263/7638
./scripts/nav.js:69682263/450
2025-05-24 01:34:49 +00:00

38 lines
649 B
JavaScript

let navItems = [
{
"href": "/",
"title": "home"
},
{
"href": "/signup",
"title": "signup"
},
{
"href": "/status",
"title": "status"
},
{
"href": "/zines",
"title": "zines!"
}
]
function populateNav() {
let nav = document.getElementById("top-nav");
let path = window.location.pathname;
for (let i = 0; i < navItems.length; i++) {
if (navItems[i].href == path) {
continue;
}
let a = document.createElement("a");
a.classList.add("nav-item");
a.href = navItems[i].href;
a.innerHTML = " " + navItems[i].title + " ";
nav.append(a);
}
}
populateNav();