How can I differentiate a manual scroll (via mousewheel/scrollbar) from a Javascript/jQuery scroll?

Try this function:

$('body,html').bind('scroll mousedown wheel DOMMouseScroll mousewheel keyup', function(e){
 if ( e.which > 0 || e.type == "mousedown" || e.type == "mousewheel"){
  $("html,body").stop();
 }
})

Also, did you see this tutorial?

Update: Modern browsers now use “wheel” as the event, so I’ve included it in the code above.

Leave a Comment