websitedesign2023/docs/assets/js/menu.js

16 lines
364 B
JavaScript

const menu = document.getElementsByTagName("nav")[0]
const menuButton = document.getElementById("menu")
var menuShown = false;
menuButton.addEventListener("click", menuToggle)
function menuToggle() {
menuShown = !menuShown;
console.log(menuShown);
if (menuShown) {
menu.className = "navshown"
} else {
menu.className = ""
}
}