HTML DOM WheelEvent deltaMode Property

The DOM WheelEvent deltaMode Property is used to return a number that represents the length unit of the scrolling values i.e. deltaX, deltaY, deltaZ. It is read-only Property. It returns three numeric values that are:

  • 0:stands for pixels
  • 1: stands for lines
  • 2: stands for pages

Syntax: 

event.deltaMode 

Return Value: It returns a numeric value that represents the length unit of the delta values. 

Example: In this example, we will see the use of  DOM WheelEvent deltaMode Property

HTML




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


Output: 

 

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

  • Google Chrome 26
  • Edge 12
  • Internet Explorer 9
  • Firefox 17
  • Opera 15
  • Safari 7

Contact Us