Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. Element
  4. touchcancel

Element: touchcancel event

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Thetouchcancel event is fired when one or more touch points have been disrupted in an implementation-specific manner.

Some examples of situations that will trigger atouchcancel event:

  • A hardware event occurs that cancels the touch activities. This may include, for example, the user switching applications using an application switcher interface or the "home" button on a mobile device.
  • The device's screen orientation is changed while the touch is active.
  • The browser decides that the user started touch input accidentally. This can happen if, for example, the hardware supports palm rejection to prevent a hand resting on the display while using a stylus from accidentally triggering events.
  • Thetouch-action CSS property prevents the input from continuing.
  • When the user interacts with too many fingers simultaneously, the browser can fire this event for all existing pointers (even if the user is still touching the screen).

Syntax

Use the event name in methods likeaddEventListener(), or set an event handler property.

js
addEventListener("touchcancel", (event) => { })ontouchcancel = (event) => { }

Event type

ATouchEvent. Inherits fromEvent.

Event UIEvent TouchEvent

Event properties

This interface inherits properties from its parent,UIEvent andEvent.

TouchEvent.altKeyRead only

A Boolean value indicating whether or not the alt key was down when the touch event was fired.

TouchEvent.changedTouchesRead only

ATouchList of all theTouch objects representing individual points of contact whose states changed between the previous touch event and this one.

TouchEvent.ctrlKeyRead only

A Boolean value indicating whether or not the control key was down when the touch event was fired.

TouchEvent.metaKeyRead only

A Boolean value indicating whether or not the meta key was down when the touch event was fired.

TouchEvent.shiftKeyRead only

A Boolean value indicating whether or not the shift key was down when the touch event was fired.

TouchEvent.targetTouchesRead only

ATouchList of all theTouch objects that are both currently in contact with the touch surfaceand were also started on the same element that is the target of the event.

TouchEvent.touchesRead only

ATouchList of all theTouch objects representing all current points of contact with the surface, regardless of target or changed status.

TouchEvent.rotationNon-standardRead only

Change in rotation (in degrees) since the event's beginning. Positive values indicate clockwise rotation; negative values indicate counterclockwise rotation. Initial value:0.0.

TouchEvent.scaleNon-standardRead only

Distance between two digits since the event's beginning. Expressed as a floating-point multiple of the initial distance between the digits at the beginning of the event. Values below 1.0 indicate an inward pinch (zoom out). Values above 1.0 indicate an outward unpinch (zoom in). Initial value:1.0.

Examples

Code samples for those events are available on the dedicated page:Touch events.

Specifications

Specification
Touch Events
# event-touchcancel
Touch Events
# dom-globaleventhandlers-ontouchcancel

Browser compatibility

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp