website/static/js/mobile-navbar.js
Filip Rojek 000bb3ea47
All checks were successful
Build and Deploy Zola Website / build_and_deploy (push) Successful in 15s
Build Zola Website / build (pull_request) Successful in 21s
Fix visible content in navbar
2024-12-15 08:32:34 +01:00

27 lines
611 B
JavaScript

const burger = document.querySelector(".hamburger")
const links = document.querySelector(".links")
const body = document.querySelector("body")
const main = document.querySelector("main")
let shown = false
burger.addEventListener("click", (e) => {
e.preventDefault()
if (!shown) {
links.style.display = "flex"
body.classList.add("disable-scroll")
burger.textContent = "x"
main.style.visibility = "hidden"
} else {
links.style.display = "none"
body.classList.remove("disable-scroll")
burger.textContent = "☰"
main.style.visibility = "visible"
}
shown = !shown
})