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
WheelEventobjects 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.
- : A string with the name of the event.
It is case-sensitive and browsers always set it to
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
deltaModeunit. It defaults to0.0.
- : A floating number representing the horizontal scroll amount in the
deltaY- : A floating number representing the vertical scroll amount in the
deltaModeunit. It defaults to0.0.
- : A floating number representing the vertical scroll amount in the
deltaZ- : A floating number representing the scroll amount for the z-axis scroll amount in the
deltaModeunit. It defaults to0.0.
- : A floating number representing the scroll amount for the z-axis scroll amount in the
deltaMode-
: An integer representing the unit of the delta values scroll amount. It defaults to
0x00. Permitted values are:Constant Value Description DOM_DELTA_PIXEL0x00The delta values are specified in pixels. DOM_DELTA_LINE0x01The delta values are specified in lines. DOM_DELTA_PAGE0x02The delta values are specified in pages.
-
- : An object that, in addition of the properties defined in MouseEvent/MouseEvent, can have the following properties:
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。离线整理了版式、链接和媒体显示。
