23 lines
491 B
JavaScript
23 lines
491 B
JavaScript
const burger = document.querySelector(".hamburger")
|
|
const links = document.querySelector(".links")
|
|
const body = document.querySelector("body")
|
|
|
|
let shown = false
|
|
|
|
burger.addEventListener("click", (e) => {
|
|
e.preventDefault()
|
|
if (!shown) {
|
|
links.style.display = "flex"
|
|
body.classList.add("disable-scroll")
|
|
burger.textContent = "x"
|
|
} else {
|
|
links.style.display = "none"
|
|
body.classList.remove("disable-scroll")
|
|
burger.textContent = "☰"
|
|
}
|
|
|
|
shown = !shown
|
|
})
|
|
|
|
|