Files
web/js/nav.js
T
2025-05-01 14:42:12 -06:00

17 lines
474 B
JavaScript

const nav = document.querySelector('nav');
const nav_links = nav.querySelectorAll('ul li a');
const theme_toggle = nav.querySelector('button');
nav_links.forEach((el) => {
el.addEventListener('click', () => {
el.preventDefault();
if ('startViewTransition' in document) {
document.startViewTransition(() => {
window.location.href = el.getAttribute('href');
});
} else {
window.location.href = el.getAttribute('href');
}
});
});