HTML | onwheel Event Attribute
This attribute works when the wheel of pointer device is rolled up or down over an element. The onwheel attribute also works when the user scrolls or zooms on an element by using mouse or touchpad.
Syntax:
<element onwheel = "script">
Attribute Value: This attribute contains single value script and it works when onwheel attribute called. It is supported by all HTML elements.
Note: This attribute is new in HTML 5.
Example:
<!DOCTYPE html> <html> <head> <title>onwheel event attribute</title> <style> #geeks { border: 1px solid black; padding:15px; width:60%; } h1 { color:green; } </style> </head> <body> <center> <h1>GeeksforGeeks</h1> <h2>onwheel event attribute</h2> <div id = "geeks" onwheel="Function()">GeeksforGeeks: A computer science portal for geeks</div> <script> function Function() { document.getElementById("geeks").style.fontSize = "30px"; document.getElementById("geeks").style.color = "green"; } </script> </center> </body> </html> |
Output:
Before:

After:

Supported Browsers: The browser supported by onwheel event attribute are listed below:
- Chrome 31.0
- Internet Explorer 9.0
- Firefox 17.0
- Safari: Not supported
- Opera 18.0
Recommended Posts:
- HTML | ondragenter Event Attribute
- HTML | onpageshow Event Attribute
- HTML | oninvalid Event Attribute
- HTML | onunload Event Attribute
- HTML | onmouseup Event Attribute
- HTML | ondrop Event Attribute
- HTML | onchange Event Attribute
- HTML | onmouseover Event Attribute
- HTML | onkeydown Event Attribute
- HTML | ontoggle Event Attribute
- HTML | ondrag Event Attribute
- HTML | onresize Event Attribute
- HTML | onreset Event Attribute
- HTML | onload Event Attribute
- HTML | onkeyup Event Attribute
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



