大网数据广告活动
Web 标准与前端开发

WheelEvent: WheelEvent() constructor

· 52CE 我爱测

The **`WheelEvent()`** constructor returns a new WheelEvent object.

Pointer Events

The WheelEvent() constructor returns a new WheelEvent object.

[!NOTE] If you construct a synthetic event using this constructor, that event will not be trusted, for security reasons. Only browser-generated WheelEvent objects are trusted and only trusted events trigger default actions.

Syntax

new WheelEvent(type)
new WheelEvent(type, options)

Parameters

  • type
    • : A string with the name of the event. It is case-sensitive and browsers always set it to wheel.
  • options
    • : An object that, in addition of the properties defined in MouseEvent/MouseEvent, can have the following properties:
      • deltaX
        • : A floating number representing the horizontal scroll amount in the deltaMode unit. It defaults to 0.0.
      • deltaY
        • : A floating number representing the vertical scroll amount in the deltaMode unit. It defaults to 0.0.
      • deltaZ
        • : A floating number representing the scroll amount for the z-axis scroll amount in the deltaMode unit. It defaults to 0.0.
      • deltaMode
        • : An integer representing the unit of the delta values scroll amount. It defaults to 0x00. Permitted values are:

          Constant Value Description
          DOM_DELTA_PIXEL 0x00 The delta values are specified in pixels.
          DOM_DELTA_LINE 0x01 The delta values are specified in lines.
          DOM_DELTA_PAGE 0x02 The delta values are specified in pages.

Return value

A new WheelEvent object.

Specifications

Browser compatibility

See also

  • The WheelEvent interface it belongs to.

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。