load bottomnav from js

This commit is contained in:
2025-12-02 10:22:42 -06:00
parent 2d391dab21
commit 8af6ee7cd5
4 changed files with 15 additions and 5 deletions

5
_bottomnav.html Normal file
View File

@@ -0,0 +1,5 @@
<ul id="bottomnav">
<li><a href="/">[/]</a></li>
<li><a href="#">[/projects]</a></li>
<li><a href="#">[/links]</a></li>
</ul>

9
assets/global.js Normal file
View File

@@ -0,0 +1,9 @@
const parser = new DOMParser();
fetch("/_bottomnav.html")
.then(response => response.text())
.then(text => {
const bottomNav = parser.parseFromString(text, "text/html");
document.body.appendChild(bottomNav.getElementById("bottomnav"));
});

View File

View File

@@ -5,6 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Im bad at naming things</title> <title>Im bad at naming things</title>
<link rel="stylesheet" href="assets/index.css"> <link rel="stylesheet" href="assets/index.css">
<script src="assets/global.js" defer></script>
</head> </head>
<body> <body>
<main> <main>
@@ -13,10 +14,5 @@
Lucielle Lucielle
</div> </div>
</main> </main>
<ul id="bottomnav">
<li><a href="/">[/]</a></li>
<li><a href="#">[/projects]</a></li>
<li><a href="#">[/links]</a></li>
</ul>
</body> </body>
</html> </html>