Fix referenceError

This commit is contained in:
Gusted
2021-01-10 18:50:20 +01:00
parent f4c660e1a8
commit c005ad9df7

View File

@ -5,11 +5,6 @@ document.querySelectorAll(".onclick-select").forEach((element) => {
// Navbar dropdowns
const navSections = document.querySelectorAll(".nav-details");
navSections.forEach(navSection => {
navSection.addEventListener("toggle", navSectionsToggle);
});
document.addEventListener("click", navSectionsClose);
const navSectionsToggle = () => {
// When opening next dropdown, hide previous
if (this.open) {
@ -21,6 +16,12 @@ const navSectionsToggle = () => {
}
}
navSections.forEach(navSection => {
navSection.addEventListener("toggle", navSectionsToggle);
});
document.addEventListener("click", navSectionsClose);
const navSectionsClose = (event) => {
// Hide all dropdowns when clicking in different place
if (