0

I have a js popup. It pops up when a link is clicked. I want to disable (vertical) scrolling on the page when that link is clicked, and then reactivate scrolling when the popup is closed. Is there any way to do this? jQuery, Javascript?

Akos
  • 1,997
  • 6
  • 27
  • 40
  • http://stackoverflow.com/questions/242608/disable-browsers-vertical-and-horizontal-scrollbars - using this disabled scrolling in Chrome for me. – millimoose Sep 01 '11 at 14:10

2 Answers2

2

you can set overflow hidden to disable the scrolling.

$('#yourDiv').css('overflow','hidden');

and to set scrol

 $('#yourDiv').css('overflow','scroll')
Jayantha Lal Sirisena
  • 21,216
  • 11
  • 71
  • 92
1

You can stop the vertical scrolling by keeping the popup position : fixed in css. Or you can do is keep overflow : hidden for body If you want this to be done from JavaScript then jQuery has the solution to change the css from .css() :)

Nihar Sawant
  • 514
  • 1
  • 4
  • 18
  • 1
    I think the OP wants to achieve fixing the popup position in the viewport. IIRC, position:fixed fixes an element's position relative to its containing element, not the browser viewport. – millimoose Sep 01 '11 at 14:12