WheelEvent deltaX Property
Example
Return whether the user scrolls left or right:
function myFunction(event) {
var x = event.deltaX;
}
Try it Yourself »
Description
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.
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
Browser Support
event.deltaX
is a DOM Level 4 (2015) feature.
It is supported in all modern browsers:
Chrome | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes |
event.deltaX
is not supported in Internet Explorer 11 (or earlier).