Kadosh Kadosh - 1 year ago 150
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 Source

You probably need to call

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

when lightbox is opened.

You also may be interested with this question.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download