Occurs when the mouse wheel rolls.
To get the distance that the mouse wheel rolled, use the detail event property. Note: the onmousewheel and DOMMouseScroll events are also fired on elements that have no scrollbar or when the contents are not scrolled. If you would like to receive a notification when the contents of an element are scrolled, use the onscroll event.
How to register:
object.addEventListener ("DOMMouseScroll", handler, useCapture);
This event cannot be registered in HTML.
The event object is accessible to all event handlers in all browsers. The properties of the event object contain additional information about the current event. To get further details about these properties and the possible event handler registration methods, please see the page for the event object.
Actions that invoke the DOMMouseScroll event:
- Rolling the mouse wheel over an element.
The order of events related to the DOMMouseScroll event:
|Internet Explorer, Opera, Google Chrome, Safari||Firefox|
Example HTML code 1:
This example implements a cross-browser solution to get the roll amount:
Did you find this example helpful?
User Contributed Comments