The touchcancel
event is fired when one or more touch points have been disrupted in an implementation-specific manner (for example, too many touch points are created).
The touchcancel
event is fired when one or more touch points have been disrupted in an implementation-specific manner (for example, too many touch points are created).
Use the event name in methods like addEventListener()
, or set an event handler property.
js
addEventListener("touchcancel", (event) => {}); ontouchcancel = (event) => {};
A TouchEvent
. Inherits from Event
.
This interface inherits properties from its parent, UIEvent
and Event
.
TouchEvent.altKey
Read only
A Boolean value indicating whether or not the alt key was down when the touch event was fired.
TouchEvent.changedTouches
Read only
A TouchList
of all the Touch
objects representing individual points of contact whose states changed between the previous touch event and this one.
TouchEvent.ctrlKey
Read only
A Boolean value indicating whether or not the control key was down when the touch event was fired.
TouchEvent.metaKey
Read only
A Boolean value indicating whether or not the meta key was down when the touch event was fired.
TouchEvent.shiftKey
Read only
A Boolean value indicating whether or not the shift key was down when the touch event was fired.
TouchEvent.targetTouches
Read only
A TouchList
of all the Touch
objects that are both currently in contact with the touch surface and were also started on the same element that is the target of the event.
TouchEvent.touches
Read only
A TouchList
of all the Touch
objects representing all current points of contact with the surface, regardless of target or changed status.
TouchEvent.rotation
Non-standard Read 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.scale
Non-standard Read 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
.
Code samples for those events are available on the dedicated page: Touch events.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
touchcancel_event |
22 | 12 | 52 | No | No | No | 4.4 | 25 | 6 | 14 | ≤3 | 1.5 |
Document
targets: touchcancel
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Element/touchcancel_event