I\'m using the scrollTo jQuery plugin and would like to know if it is somehow possible to temporarily disable scrolling on the window element through Javascript? The reason
I know this is an old question, but I had to do something very similar, and after some time looking for an answer and trying different approaches, I ended up using a very easy solution.
My problem was very similar, almost identical, the only difference is I didn't have to actually show the scroll bar - I just had to make sure its width would still be used, so the page's width would not change while my overlay was displayed.
When I start sliding my overlay into the screen, I do:
$('body').addClass('stop-scrolling').css('margin-right', 8);
and after I slide my overlay off the screen I do:
$('body').removeClass('stop-scrolling').css('margin-right', 0);
IMPORTANT: this works perfectly because my overlay is positioned absolute
, right: 0px
when visible
.