Open In App

HTML DOM WheelEvent deltaZ Property

Last Updated : 21 Jun, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

The HTML DOM WheelEvent deltaZ Property is used to return a positive double value when the web page is scrolled in and returns a negative value when the page is scrolled out else it returns zero. It is a read-only property. 

Syntax: 

event.deltaZ

Return Value: It returns a double value which indicates the scrolling direction of the mouse wheel. 

Example: In this article, we will see the use of DOM WheelEvent deltaZ Property.

HTML




<!DOCTYPE html>
<html>
 
<head>
    <title>
        DOM WheelEvent deltaZ Property
    </title>
</head>
 
<body onwheel="Geeks(event)"
      style="text-align: center;
             width: 1000px;">
    <h1 style="color: green;">
        GeeksforGeeks
    </h1>
    <h2>
        DOM WheelEvent deltaZ Property
    </h2>
    <p>Scroll to see effect:</p>
    <p id="p"></p>
 
    <script>
        function Geeks(event) {
            let doc = event.deltaZ;
            document.getElementById("p")
                  .innerHTML = doc;
        }
    </script>
 
</body>
 
</html>


Output: 

 

Supported Browsers: The browsers supported by DOM WheelEvent deltaZ Property are listed below:

  • Google Chrome 31
  • Edge 12
  • Internet Explorer 9
  • Firefox 17
  • Opera 18
  • Safari 8

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads