stop scrolling of webpage with jquery

2019-02-20 14: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.

2条回答
别忘想泡老子
2楼-- · 2019-02-20 15:03

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

查看更多
Rolldiameter
3楼-- · 2019-02-20 15:14

Easiest way to achieve this

$("body").css("overflow", "hidden");
查看更多
登录 后发表回答