scroll and mousewheel

Test page.

Events overview page.

These events allow you to monitor the user’s scolling.

scroll
Fires when the user scrolls an element by any means (arrow keys, scrollbar or mouse wheel). You cannot prevent the scrolling.
mousewheel
Fires when the user uses the mouse wheel. You can prevent this event’s default. Note that the page does not have to scroll in order to fire this event.
wheel
Equivalent of mousewheel.

scroll

Test IE 5.5 IE 6 IE 7 IE8 IE9 IE10 pr2 FF 7.0 Win FF 6.1 Mac Saf 5.1 Win Saf 5.1 Mac Chrome 14 Win Chrome 13 Mac Opera 11.51 Win Opera 11.51 Mac
On the window
Yes Yes Yes Yes Yes

Is the scroll event available on the window?

On the document
No Yes Yes Yes Yes Yes

Is the scroll event available on the document?

  • Safari iPhone also fires this event when the user zooms in or out.
On any element with overflow: auto
Yes Yes Yes Yes Yes

Is the scroll event available on elements with overflow: auto?

Event bubbling
“No” is the correct answer

The scroll event does not bubble up.

No No No No No

Although the event does not bubble, browsers fire a scroll event on both document and window when the user scrolls the entire page.

Test IE 5.5 IE 6 IE 7 IE8 IE9 IE10 pr2 FF 7.0 Win FF 6.1 Mac Saf 5.1 Win Saf 5.1 Mac Chrome 14 Win Chrome 13 Mac Opera 11.51 Win Opera 11.51 Mac

Mousewheel and wheel

Mousewheel and wheel fire when you use the mousewheel or trackpad. You can prevent the default.

Test IE 5.5 IE 6 IE 7 IE8 IE9 IE10 pr2 FF 7.0 Win FF 6.1 Mac Saf 5.1 Win Saf 5.1 Mac Chrome 14 Win Chrome 13 Mac Opera 11.51 Win Opera 11.51 Mac
On the window
No No Yes Yes Yes

Is this event available on the window?

On the document
No Yes Buggy Yes No Yes Yes Yes

Is this event available on the document?

On any element with scrollbars
No Yes Buggy Yes No Yes Yes Yes

Is this event available on any element with scrollbars?

Test IE 5.5 IE 6 IE 7 IE8 IE9 IE10 pr2 FF 7.0 Win FF 6.1 Mac Saf 5.1 Win Saf 5.1 Mac Chrome 14 Win Chrome 13 Mac Opera 11.51 Win Opera 11.51 Mac
Bubbles

The mousewheel event should bubble up.

Untestable Yes Untestable Yes Yes Yes
Cancel bubble

The bubbling can be canceled.

Untestable Yes Untestable Yes Yes Yes
Prevent default

The default (scroll element) can be prevented.

Untestable Yes Buggy Yes Untestable Yes Yes Yes
wheel event

Equivalent of mousewheel

No Yes No No No No

Only works with addEventListener.

Test IE 5.5 IE 6 IE 7 IE8 IE9 IE10 pr2 FF 7.0 Win FF 6.1 Mac Saf 5.1 Win Saf 5.1 Mac Chrome 14 Win Chrome 13 Mac Opera 11.51 Win Opera 11.51 Mac

IE8

If a mousewheel event handler is defined on an element in IE8, using the mouse wheel does not scroll the element. The event fires correctly, though. In other words, IE8 always prevents the default of the mousewheel event.