5

Is it possible to prevent scroll event in jQuery?

I've tried this code, but it didn't work.

$('*').scroll(function(event){
  event.stopPropagation();
  event.preventDefault();
  return false;
})
1
  • Check this Commented Jun 25, 2012 at 8:14

3 Answers 3

7

You can disable scrolling within certain element areas using the following:

$("element,element2").bind("touchmove",function(e){
    e.preventDefault();
});
Sign up to request clarification or add additional context in comments.

Comments

2

Just set the body CSS to disable the scroll.

body {    
   overflow: hidden; 
}

1 Comment

thanks, it would work but not in my case.. i'm looking for something like to catch "keycode" or "scroll" event and pervent this. and i have to do this on mobile devise "Samsung", any ideas?
0

well.. i worked with wrong event. touchmove was exactly what i'm looked for. so

$('body').bind('touchmove', function(e){
  e.preventDefault();
});

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.