0

I'm trying to stop the scroll effect from propagating past a certain element and I know how to do it but it seems it's not the mousewheel event that propagates but some other event. Any idea which one it is?

Bogdan
  • 1,869
  • 6
  • 24
  • 53
  • Try looking at the answer for this question http://stackoverflow.com/questions/3787555/how-to-find-out-which-javascript-events-fired – Bogdan Jun 28 '12 at 11:38
  • I did and the results are confusing. I determined that it's the 'scroll' event that fires but there's no way of stopping its propagation. – Bogdan Jun 28 '12 at 11:54
  • Have you tried using stopPropagation() for the scroll event? http://api.jquery.com/event.stopPropagation/ – Bogdan Jun 28 '12 at 12:21
  • From the jQuery docs: `In all browsers, the load, scroll, and error events (e.g., on an element) do not bubble.` - therefore, there is no point in stopping further propagation of these events, since it does not happen anyway. `event.stopImmediatePropagation()` might work. (but don't confuse this with the default behavior = scrolling the site/frame/element, that can not be suppressed for these events). – Niko Jun 28 '12 at 12:57

1 Answers1

0

You can try in jQuery:

$(window).scroll(function(event){
    window.scrollTo(0,0);
});

Also, there is plugin: https://raw.github.com/brandonaaron/jquery-mousewheel/master/jquery.mousewheel.js

Here is an example of use: http://jsbin.com/ixura3/3

However, I suggest you avoid these methods, because scrolling is default function and user can be angry if your website suddenly breaks this behavior.

maxwell
  • 857
  • 8
  • 16