diff --git a/assets/js/main.js b/assets/js/main.js index 11acbd9a..9647dc0f 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -16,12 +16,6 @@ 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 ( @@ -35,6 +29,11 @@ const navSectionsClose = (event) => { } +navSections.forEach(navSection => { + navSection.addEventListener("toggle", navSectionsToggle); +}); +document.addEventListener("click", navSectionsClose); + // Dark/Light color scheme switch button document.querySelector("#nav-switch-theme").style.display = "inline"; document.querySelector("#nav-switch-theme").addEventListener("click", changeColorScheme);