Skip to content

Commit

Permalink
Fixing click behavior if the menu is not found.
Browse files Browse the repository at this point in the history
  • Loading branch information
mariacha committed Nov 12, 2024
1 parent 6533755 commit 6404b7f
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions themes/custom/ts_wrin/js/components/ts_header_nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,12 +340,14 @@ export default function(context) {
});
}

// Close the menu if clicking outside of it
document.addEventListener("click", function() {
if (menuContainer.classList.contains("menu-open")) {
menuContainer.classList.remove("menu-open");
menuContainer.classList.add("menu-closed");
}
});
if (menuContainer) {
// Close the menu if clicking outside of it
document.addEventListener("click", function() {
if (menuContainer.classList.contains("menu-open")) {
menuContainer.classList.remove("menu-open");
menuContainer.classList.add("menu-closed");
}
});
}
}
}

0 comments on commit 6404b7f

Please sign in to comment.