Skip to content

Commit

Permalink
scroll fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nkpn committed Aug 20, 2024
1 parent aad0aee commit 2ea9623
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,23 @@ document.addEventListener("DOMContentLoaded", function() {
// Mobile Header Menu Show / Hide function
const toggleCheckbox = document.getElementById("toggle");
const mobileMenu = document.querySelector(".mobile-menu");

const headerContainer = document.querySelector('.header-container');

if (mobileMenu && toggleCheckbox) {
toggleCheckbox.addEventListener("change", function() {
if (toggleCheckbox.checked) {
mobileMenu.classList.add('opened')
document.body.classList.add('no-scroll');
document.body.classList.add('no-scroll'); // hide Y scroll
headerContainer.body.classList.add('no-scroll'); // hide Y scroll

setTimeout(() => {
mobileMenu.style.display = "flex";
}, 200);
} else {
mobileMenu.classList.remove('opened')
document.body.classList.remove('no-scroll');
headerContainer.body.classList.remove('no-scroll');

setTimeout(() => {
mobileMenu.style.display = "none";
}, 300);
Expand Down

0 comments on commit 2ea9623

Please sign in to comment.