Skip to content

Commit

Permalink
Update burger-menu.js
Browse files Browse the repository at this point in the history
  • Loading branch information
KristinaHranovska committed Feb 14, 2024
1 parent a24b2bc commit f0f5f5c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/js/burger-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ const homeButton = document.querySelector('.link-home');
backdrop: document.querySelector('.background-menu'),
};

const backdrop = document.querySelector('.backdrop');
backdrop.classList.add('is-hidden');
refs.modal.classList.add('is-hidden');

refs.openModalBtn.addEventListener('click', function () {
toggleModal();
Expand All @@ -21,8 +20,8 @@ const homeButton = document.querySelector('.link-home');
enableScroll();
});

document.addEventListener('click', function (event) {
if (!refs.modal.contains(event.target) && !refs.openModalBtn.contains(event.target)) {
refs.backdrop.addEventListener('click', function (event) {
if (event.target === refs.backdrop) {
toggleModal();
enableScroll();
}
Expand Down

0 comments on commit f0f5f5c

Please sign in to comment.