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.
Asked
Active
Viewed 7,834 times
2 Answers
1
Easiest way to achieve this
$("body").css("overflow", "hidden");

Tarun Gupta
- 6,305
- 2
- 42
- 39
-
This is a good idea, but doesn't work on all browsers (Chrome, Firefox). I found $("body").css("position", "static") more effective. – Rupert Rawnsley Jan 05 '14 at 10:15
-
@RupertRawnsley It worked.. I have used and tested in one of my website – Tarun Gupta Jan 05 '14 at 17:29
-
1The 'overflow' method fails for me on my real-world page, but works fine on this simple page: http://jsfiddle.net/DX24z/1/ so perhaps I'm doing something unusual somewhere else on the page. The 'position' method works in both cases. Also, I meant to say 'fixed' rather than 'static', but I can't edit it now. – Rupert Rawnsley Jan 06 '14 at 07:59