Skip to content

Commit

Permalink
Enhanced UX a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
AzimKrishna committed Nov 26, 2023
1 parent 0117eaa commit ec41b0e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,19 @@ document.addEventListener("DOMContentLoaded", () => {
var toggleMenu = () => {
containerLeft.classList.toggle('v-class');
burgerIcon.classList.toggle('cross');
console.log('hey1');
};

burgerIcon.addEventListener('click', toggleMenu);

document.body.addEventListener('click', (event) => {
const target = event.target;

// Check if the clicked element is not inside the containerLeft
if (!containerLeft.contains(target) && !burgerIcon.contains(target)) {
containerLeft.classList.remove('v-class');
burgerIcon.classList.remove('cross');
}
});

});

0 comments on commit ec41b0e

Please sign in to comment.