Return the length unit of the delta values:
function myFunction(event) {
var x = event.deltaMode;
// 0 = pixels
// 1 = lines
// 2 = pages
}
Try it Yourself »
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.
event.deltaMode
Return Value: | A Number, indicating the length unit of the delta values Possible values: 0 = pixels 1 = lines 2 = pages |
---|
HTML DOM reference: WheelEvent deltaX Property
HTML DOM reference: WheelEvent deltaY Property
HTML DOM reference: WheelEvent deltaZ Property
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 |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!