Open In App
Related Articles

HTML | onwheel Event Attribute

Improve Article
Save Article
Like Article

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.

Supported Tags: It supports all HTML elements. 


<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.



<!DOCTYPE html>
    <title>onwheel event attribute</title>
        #geeks {
            border: 1px solid black;
            padding: 15px;
            width: 60%;
        h1 {
            color: green;
        <h2>onwheel event attribute</h2>
        <div id="geeks" onwheel="Function()">GeeksforGeeks:
            A computer science portal for geeks</div>
            function Function() {
                document.getElementById("geeks").style.fontSize = "30px";
                document.getElementById("geeks").style.color = "green";



Supported Browsers: The browser supported by onwheel event attribute are listed below: 

  • Chrome 31.0
  • Edge 12.0
  • Internet Explorer 9.0
  • Firefox 17.0
  • Safari 7.0
  • Opera 18.0

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 18 Aug, 2022
Like Article
Save Article
Similar Reads
Related Tutorials