THE WORLD'S LARGEST WEB DEVELOPER SITE

WheelEvent deltaX Property

❮ DOM Events ❮ WheelEvent

Example

Return whether the user scrolls left or right:

function myFunction(event) {
  var x = event.deltaX;
}
Try it Yourself »

Definition and Usage

The deltaX property returns a positive value when scrolling to the right, and a negative value when scrolling to the left, otherwise 0.

Note: Most mouse devices do not have the ability to scroll left and right, and will always return 0.

Note: This property is read-only.


Browser Support

Property
deltaX 31 yes 17 Not supported 18

Syntax

event.deltaX

Technical Details

Return Value: A Double, indicating the scrolling direction of the mouse wheel

Related Pages

HTML DOM reference: WheelEvent deltaY Property


❮ DOM Events ❮ WheelEvent