stop scrolling of webpage with jquery

时光怂恿深爱的人放手 提交于 2019-12-19 11:22:14

问题


I am using a query bumpbox plugin with the webpage, I am working on but I can still scroll away from the bumpbox when I am using it. I was wondering if there was some sort of jquery method that will keep the webpage from scrolling or just scroll the opposite way with the same distance that the user scrolled.


回答1:


It's hard to be specific with no code posted, but to prevent scrolling you could do something like :

$(window)​​.on('scroll', function() {
    $(this).scrollTop(100); //sets the scrollposition to 100px
})​​;​

FIDDLE




回答2:


Easiest way to achieve this

$("body").css("overflow", "hidden");


来源:https://stackoverflow.com/questions/10670487/stop-scrolling-of-webpage-with-jquery

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!