add: boostrap navbar

This commit is contained in:
AdrienLSH
2024-01-05 11:40:22 +01:00
parent 9f7b813292
commit 7a595d37ec
2 changed files with 21 additions and 10 deletions

View File

@ -109,10 +109,15 @@ document.addEventListener("DOMContentLoaded", () => {
document.body.addEventListener("click", e => {
if (e.target.matches("[data-link]")) {
e.preventDefault();
document.querySelectorAll('[data-link]').forEach(e => {
e.classList.remove('active');
});
e.target.classList.add('active');
navigateTo(e.target.href.slice(location.origin.length));
}
});
router(location.pathname);
document.querySelector('a[href=\'' + location.pathname + '\']').classList.add('active');
});
export { client, navigateTo }