MitchH
(Michiel Hoorn)
July 30, 2024, 1:30pm
1
HI all,
currently working on a project where I implemented Lenis smooth scrolling script. Now I also have a Menu, which once opened needs to set body to disable-scroll. Unfortunatley it seems not to work with finsweet no-scroll attributes.
Who has a solution for this?
Thanks,
Michiel
Read only link:
https://preview.webflow.com/preview/dev-real-dutch-floor?utm_medium=preview_link&utm_source=designer&utm_content=dev-real-dutch-floor&preview=60434f15e75320cda3e32d74622706f1&workflow=preview
Hey, I run into the same problem and added the following code :
// To keep track of whether Lenis is paused or started
let isPaused = false;
// Add event listener for elements with class ‘.nav_button’
document.querySelectorAll(‘.nav_button’).forEach(button => {
button.addEventListener(‘click’, () => {
if (isPaused) {
lenis.start(); // Resume smooth scrolling
isPaused = false;
} else {
lenis.stop(); // Pause smooth scrolling
isPaused = true;
}
});
});