I have created a mobile menu that is opening fine when I click on the "hamburger" icon. (Not an image, created with divs and css). I am having some trouble figuring out how to close the mobile menu when a user clicks on the "hamburger" icon. Any tips would be greatly appreciated!
const hamburgerBtn = document.getElementById("hamburger");
const navLink = document.querySelector(".nav__links");
navLink.style.left = "-100%";
hamburgerBtn.addEventListener("click", () => {
if ((navLink.style.left = "-100%")) {
navLink.style.left = "0%";
}
});
Code above is how I am able to make the mobile menu appear.