Movatterモバイル変換


[0]ホーム

URL:


MDN Web Docs

TouchEvent: TouchEvent() constructor

Limited availability

TheTouchEvent() constructor creates a newTouchEvent object.

Note:If you construct a synthetic event using this constructor, that event will not betrusted, for security reasons.Only browser-generatedTouchEvent objects are trusted and only trusted events trigger default actions.

Syntax

js
new TouchEvent(type)new TouchEvent(type, options)

Parameters

type

A string with the name of the event.It is case-sensitive and browsers set it totouchstart,touchend,touchmove,touchcancel

optionsOptional

An object that,in addition of the properties defined inUIEvent(), can have the following properties:

touchesOptional

ATouchList, defaulting to an empty one, that is a list of objects for every point of contact currently touching the surface.

targetTouchesOptional

ATouchList, defaulting to an empty one, that is a list of objects for every point of contact that is touching the surfaceand started on the element that is the target of the current event.

changedTouchesOptional

and defaulting to[], of typeTouch[], that is a list of objects for every point of contact which contributed to the event.

ctrlKeyOptional

A boolean value, defaulting tofalse, indicating if thectrl key was simultaneously pressed.

shiftKeyOptional

A boolean value, defaulting tofalse, indicating if theshift key was simultaneously pressed.

altKeyOptional

A boolean value, defaulting tofalse, indicating if thealt key was simultaneously pressed.

metaKeyOptional

A boolean value, defaulting tofalse, indicating if themeta key was simultaneously pressed.

Return value

A newTouchEvent object.

Specifications

Specification
Touch Events
# dom-touchevent-constructor

Browser compatibility

See also

  • TouchEvent, the interface of the objects it constructs.

Help improve MDN

Learn how to contribute.

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp