(hamburger-menu.js)
const hamburgerMenuBtn = document.getElementById("hamburger-menu-button");
hamburgerMenuBtn.addEventListener("click", function(){hamburgerPopupToggle()});
function hamburgerPopupToggle() {
console.log("Button pressed");
const hamburgerMenuPopup = document.getElementById("hamburger-menu-popup");
if (hamburgerMenuPopup.style.display === "block") {
hamburgerMenuPopup.style.display = "none";
console.log(hamburgerMenuPopup.style.display);
}
else {
hamburgerMenuPopup.style.display = "block";
console.log(hamburgerMenuPopup.style.display);
}
}
The popup opens
(https://i.sstatic.net/4hlVl4VL.png)
But then instead of setting display style back to “none”, it sets it to “unset !important”, BUT it logs that it’s “none” (https://i.sstatic.net/DadeuwQ4.png)(https://i.sstatic.net/bmL9RzHU.png)
So, for some reason it logs what was supposed to happen, but the CSS doesn’t change whatsoever. (It changes, but not as expected)
New contributor
francheez is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.