Javascript DOM WheelEvent deltaZ Property

Introduction

Return whether the user scrolls in or out along the z-axis.

Most mouse devices do not have the ability to scroll along the z-axis, and will always return 0.

View in separate window

<!DOCTYPE html>
<html>
<body onwheel="myFunction(event)">
<p>Scroll this page to see the value of the deltaZ property.</p>
<p id="demo"></p>

<script>
function myFunction(event) {/*from  w w w  .  j a va  2  s  .  co  m*/
  var z = event.deltaZ;
  document.getElementById("demo").innerHTML = z;
}
</script>

</body>
</html>

The deltaZ property returns a Double indicating the scrolling direction of the mouse wheel.

The deltaZ property returns a positive value when scrolling in, and a negative value when scrolling out, otherwise 0.

Most mouse devices do not have the ability to scroll along the z-axis, and will always return 0.

This property is read-only.




PreviousNext

Related