nav - finish nav expanded dynamic columns

This commit is contained in:
isUnknown 2024-08-27 14:28:25 +02:00
parent 049f11e011
commit 220a6f4ada
6 changed files with 49 additions and 26 deletions

23
assets/js/functions.js Normal file
View file

@ -0,0 +1,23 @@
let handleClick;
function expandNav(nodes) {
nodes.expandedNav.classList.add("open");
nodes.burgerBtn.setAttribute("aria-expanded", true);
nodes.closeNavBtn.setAttribute("aria-expanded", true);
handleClick = () => closeNav(nodes);
nodes.main.addEventListener("click", handleClick);
}
function closeNav(nodes) {
console.log("close nav");
nodes.expandedNav.classList.remove("open");
nodes.burgerBtn.setAttribute("aria-expanded", false);
nodes.closeNavBtn.setAttribute("aria-expanded", false);
nodes.main.removeEventListener("click", handleClick);
}
export { expandNav, closeNav };