Skip to content

Commit

Permalink
Close navigation menu when dark overlay is clicked on
Browse files Browse the repository at this point in the history
  • Loading branch information
cszach committed Oct 15, 2023
1 parent c2797a0 commit 45cb83b
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ document.addEventListener('DOMContentLoaded', () => {

navigationLinks.forEach(navigationLink => {
navigationLink.addEventListener('click', () => {
document.body.classList.remove('overflow-hidden');
hamburgerCheckbox.checked = false;
closeNavigationMenu();
});
});

Expand Down Expand Up @@ -43,6 +42,19 @@ document.addEventListener('DOMContentLoaded', () => {
}
});

// Close navigation menu when the dark overlay is clicked on

const darkOverlay = navBar.querySelector('.bg-black');

darkOverlay.addEventListener('click', () => {
closeNavigationMenu();
});

function closeNavigationMenu() {
document.body.classList.remove('overflow-hidden');
hamburgerCheckbox.checked = false;
}

// particles.js

particlesJS.load('faq', 'assets/particlesjs-config.json');
Expand Down

0 comments on commit 45cb83b

Please sign in to comment.