WheelEvent deltaMode Property

Example

Return the length unit of the delta values:

function myFunction(event) {
  var x = event.deltaMode;
  // 0 = pixels
  // 1 = lines
  // 2 = pages
}
Try it Yourself »

Description

The deltaMode property returns a number representing the length unit of the scrolling values (deltaX, deltaY, and deltaZ).

0 = pixels
1 = lines
2 = pages

Note: This property is read-only.


Syntax

event.deltaMode

Technical Details

Return Value: A Number, indicating the length unit of the delta values
Possible values:
0 = pixels
1 = lines
2 = pages

Related Pages

HTML DOM reference: WheelEvent deltaX Property

HTML DOM reference: WheelEvent deltaY Property

HTML DOM reference: WheelEvent deltaZ Property


Browser Support

event.deltaMode is a DOM Level 3 (2004) feature.

It is fully supported in all modern browsers:

Chrome Edge Firefox Safari Opera IE
Yes Yes Yes Yes Yes 11


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.