WheelEvent.deltaMode

WheelEvent.deltaMode 只读属性返回一个 unsigned long 类型的值, 声明 delta 的滚动值的单位. 可能的值为:

Constant Value Description
DOM_DELTA_PIXEL 0x00 delta 的值为 像素 级别.
DOM_DELTA_LINE 0x01 delta 的值为 行 级别.
DOM_DELTA_PAGE 0x02 delta 的值为 页 级别.

语法

var unit = event.deltaMode;

例子

var syntheticEvent = new WheelEvent("syntheticWheel", {"deltaX": 4, "deltaMode": 0});

console.log(syntheticEvent.deltaMode);

规范

Specification Status Comment
Document Object Model (DOM) Level 3 Events Specification
WheelEvent.deltaMode
Obsolete Initial definition.

浏览器兼容性

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 31 (Yes) 17.0 (17.0) 9.0 18 7.0
Feature Android Edge Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support (Yes) (Yes) 17.0 (17.0) ? (Yes) 未实现

另见

文档标签和贡献者

标签: 
 此页面的贡献者: Jiang-Xuan
 最后编辑者: Jiang-Xuan,