Files
fedizinefest-deprecated/scripts/nav.js
T

39 lines
658 B
JavaScript
Raw Normal View History

2025-05-24 01:23:19 +00:00
let navItems = [
{
"href": "/",
"title": "home"
},
{
"href": "/signup",
2025-05-24 02:26:58 +00:00
"title": "get involved"
2025-05-24 01:23:19 +00:00
},
{
"href": "/zines",
"title": "zines!"
2025-05-24 01:57:31 +00:00
},
{
"href": "/years",
2025-05-24 02:26:58 +00:00
"title": "all years"
2025-05-24 01:34:49 +00:00
}
2025-05-24 01:23:19 +00:00
]
function populateNav() {
let nav = document.getElementById("top-nav");
2025-05-24 01:34:49 +00:00
let path = window.location.pathname;
2025-05-24 01:23:19 +00:00
for (let i = 0; i < navItems.length; i++) {
2025-05-24 01:34:49 +00:00
if (navItems[i].href == path) {
continue;
}
2025-05-24 01:23:19 +00:00
let a = document.createElement("a");
a.classList.add("nav-item");
a.href = navItems[i].href;
2025-05-24 01:34:49 +00:00
a.innerHTML = " " + navItems[i].title + " ";
2025-05-24 01:23:19 +00:00
nav.append(a);
}
2025-05-24 01:34:49 +00:00
}
2026-01-06 12:44:14 -08:00
populateNav();