开发者

Kill vertical scrolling when a link is clicked?

开发者 https://www.devze.com 2023-04-01 01:57 出处:网络
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 clo

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() :)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号