1

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.

Cameron
  • 584
  • 8
  • 23
  • Here is the link to the examples for the plugin I am using:http://direseas.com/examples/bumpbox/ – Cameron May 20 '12 at 03:16

2 Answers2

4

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

adeneo
  • 293,187
  • 26
  • 361
  • 361
1

Easiest way to achieve this

$("body").css("overflow", "hidden");
Tarun Gupta
  • 5,881
  • 2
  • 36
  • 38
  • 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
  • 1
    The '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