HTML | DOM WheelEvent deltaZ Property

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:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!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) {
            var doc = event.deltaZ;
            document.getElementById(
              "p").innerHTML = doc;
        }
    </script>
  
</body>
  
</html>

chevron_right


Output:
Before Scroll:

After Scroll:

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

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

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.




Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.