How to stop scrolling with an overlay modal?

158 Views Asked by At

I started using locomotive and made an overlay menu. Normally I should have use an overflow hidden. But here it's not working

.scroll-stop
{
    overflow: hidden !important;
}
$('#toggle').click(function() {
    $(this).toggleClass('active');
    $('#overlay').toggleClass('open');
    $('body').toggleClass('scroll-stop');
});
1

There are 1 best solutions below

1
gatre On

You can use the stop() and start() methods to disable and enable scrolling. https://github.com/locomotivemtl/locomotive-scroll#instance-methods