moved inline javascript to it's own file

This commit is contained in:
Johannes Erwerle 2026-10-21 21:54:29 +02:00
parent 5813d200dc
commit 26f3d5d033
2 changed files with 26 additions and 24 deletions

View file

@ -0,0 +1,24 @@
//
// Activation script for the bulma burger menu.
// Copied from https://bulma.io/documentation/components/navbar/
//
document.addEventListener('DOMContentLoaded', () => {
// Get all "navbar-burger" elements
const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);
// Add a click event on each of them
$navbarBurgers.forEach( el => {
el.addEventListener('click', () => {
// Get the target from the "data-target" attribute
const target = el.dataset.target;
const $target = document.getElementById(target);
// Toggle the "is-active" class on both the "navbar-burger" and the "navbar-menu"
el.classList.toggle('is-active');
$target.classList.toggle('is-active');
});
});
});