To prevent scrolling on a mobile menu I would like to set the body tag to overflow: hidden; just when the the mobile menu is active. Therefore I like need to make an if statement like in the example
if (mobileMenu) {
document.body.classList.add('active-modal');
} else {
document.body.classList.remove('active-modal');
}
I already searched for solutions and here is a great article about how to solve it. BUT ANYWAY I was not able to fix it with this solution, so I would like to ask for help…
I know that this is a common issue and a beginners challenge…