Kill vertical scrolling when a link is clicked?
I have a js popup. It pops up when a link is clicked. I want to disable (vertical) scrolling on the page w开发者_如何转开发hen that link is clicked, and then reactivate scrolling when the popup is closed. Is there any way to do this? jQuery, Javascript?
you can set overflow hidden
to disable the scrolling.
$('#yourDiv').css('overflow','hidden');
and to set scrol
$('#yourDiv').css('overflow','scroll')
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()
:)
精彩评论