Kadosh Kadosh - 7 days ago 5
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?

Answer

You probably need to call

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

when lightbox is opened.

You also may be interested with this question.

Comments