Return whether the user scrolls left or right:
Most mouse devices do not have the ability to scroll left and right, and will always return 0.
<!DOCTYPE html> <html> <body onwheel="myFunction(event)"> <p>Scroll this page to see the value of the deltaX property.</p> <p id="demo"></p> <script> function myFunction(event) {//from w ww . j a v a2 s . c o m var x = event.deltaX; document.getElementById("demo").innerHTML = x; } </script> </body> </html>
The deltaX property returns a Double indicating the scrolling direction of the mouse wheel.
The deltaX property returns a positive value when scrolling to the right, and a negative value when scrolling to the left, otherwise 0.
Most mouse devices do not have the ability to scroll left and right, and will always return 0.
This property is read-only.