hugo-batsite/public/js/hamburger.js
2022-04-16 15:27:59 +02:00

25 lines
513 B
JavaScript

const button = document.getElementById("hamburger-button");
const bg = document.getElementById("hamburger-bg");
let hidden = true;
export function activateHamburger() {
button.addEventListener("click", function () {
hidden = !hidden;
console.log(hidden);
if (hidden === true) {
hide();
} else {
unhide();
}
});
}
function unhide() {
bg.classList.remove("hidden");
button.innerHTML = "窱";
}
function hide() {
bg.classList.add("hidden");
button.innerHTML = "";
}