Kadosh Kadosh - 2 months ago 32
Javascript Question

disable main window scrolling - Jquery

I have a webpage with a lightbox in it, inside the lightbox there is a scrollbar.
I want to disable the main window scrollbar and keep the lightbox scrollbar enabled.

Not just to hide the scrollbar but to disable scrolling of the window at all (beside scrolling the lightbox).

How can I do it?


You probably need to call

$("body").scroll(function(e){ e.preventDefault()});

when lightbox is opened.

You also may be interested with this question.