Hello,
I have a pop-up window on my site that appears after 5 seconds of the website loading.
I am trying to disable the ability to scroll the site when the pop-up is shown. and enable scrolling when its closed (via close button or background click)
I tried to add:
$('.pop-up').on('mouseenter mouseleave', function() {
$('body').toggleClass('no-scroll');
});
To disable scrolling on the body when the pop-up is hovered (100vw,100vh) but it doesn’t work perfectly because the user can still scroll if he uses a trackpad on a laptop and didn’t move the indicator after the pop-up appeared. On mobile, it just doesn’t work.
Is there a way to go around it?
Read-only link
Thank you for any help