nav - finish nav expanded dynamic columns
This commit is contained in:
parent
049f11e011
commit
220a6f4ada
6 changed files with 49 additions and 26 deletions
23
assets/js/functions.js
Normal file
23
assets/js/functions.js
Normal 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 };
|
||||
Loading…
Add table
Add a link
Reference in a new issue