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'm sorry to answer an old post but I was looking for a solution and came across this question.
There are many workarounds for this issue to still display the scrollbar, like giving the container a 100% height and an overflow-y: scroll
styling.
In my case I just created a div with a scrollbar which I display while adding overflow: hidden
to the body:
function disableScroll() {
document.getElementById('scrollbar').style.display = 'block';
document.body.style.overflow = 'hidden';
}
The element scrollbar must have this styles:
overflow-y: scroll; top: 0; right: 0; display: none; height: 100%; position: fixed;
This shows a grey scrollbar, hope it helps future visitors.