Tutorials References Exercises Videos Menu
Create Website Get Certified Upgrade

HTML onmousewheel Attribute


Definition and Usage

The onmousewheel attribute fires when the mouse wheel is rolled up or down over an element.

Deprecated. The onmousewheel attribute is deprecated, you should use the onwheel attribute instead.


Applies to

The onmousewheel attribute is part of the Event Attributes, and can be used on any HTML elements.

Elements Event
All HTML elements onmousewheel

Example

Img Example

Execute a JavaScript when the user rolls the mouse wheel over a <div> element:

<div onwmousewheel="myFunction()">Roll the mouse wheel over me</div>
Try it Yourself »

Browser Support

Event Attribute
onmousewheel Yes Yes Not supported Yes Yes