diff --git a/main.js b/main.js index 433cf63..9566c06 100644 --- a/main.js +++ b/main.js @@ -23,6 +23,7 @@ window.addEventListener("scroll", function () { }); // Header responsive +const links = document.querySelectorAll(".link"); const buttonMenu = document.getElementById("button-menu"); const menu = document.querySelector(".nav__links"); @@ -30,6 +31,12 @@ buttonMenu.addEventListener("click", () => { menu.classList.toggle("show__menu"); }); +links.forEach((link) => { + link.addEventListener("click", function () { + menu.classList.remove("show__menu"); + }); +}); + // Reveal option const scrollRevealOption = { distance: "50px", diff --git a/styles.css b/styles.css index c83dbd7..1d7c9d6 100644 --- a/styles.css +++ b/styles.css @@ -815,7 +815,7 @@ nav { } .nav__links { - position: absolute; + position: fixed; top: 50px; right: -110%; width: 100%;