Fix navigation detail with menu

This commit is contained in:
prototypa
2022-08-19 04:52:54 -04:00
parent 59b4808461
commit 46f79355f6
2 changed files with 10 additions and 3 deletions

View File

@ -28,7 +28,7 @@ const {} = Astro.props;
window.onload = function () {
attachEvent("[data-aw-toggle-menu]", "click", function (elem) {
elem.classList.toggle("menu-opened");
elem.classList.toggle("expanded");
document.getElementById("menu").classList.toggle("hidden");
});
@ -39,4 +39,11 @@ const {} = Astro.props;
: "light";
});
};
window.onpageshow = function () {
const elem = document.querySelector("[data-aw-toggle-menu]");
if (elem) {
elem.classList.remove("expanded");
}
document.getElementById("menu").classList.add("hidden");
};
</script>