😺💾 Checkpoint
./2024/index.html:69682263/625 ./for-artists/index.html:69682263/7638 ./scripts/nav.js:69682263/450
This commit is contained in:
38
scripts/nav.js
Normal file
38
scripts/nav.js
Normal file
@ -0,0 +1,38 @@
|
||||
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();
|
||||
Reference in New Issue
Block a user