Cleanup Javascript #2185

Closed
Gusted wants to merge 4 commits from Javascript-Cleanup into master
3 changed files with 62 additions and 201 deletions
Showing only changes of commit c005ad9df7 - Show all commits

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 (