TouchEvent touches Property
Example
Find out how many fingers that touches the surface:
function countTouches(event) {
var x = event.touches.length;
}
Try it Yourself »
Description
The touches property returns an array of Touch objects, one for each finger that is currently touching the surface.
Note: This property is read-only.
Syntax
event.touches
Technical Details
Return Value: | An Array of Touch objects. |
---|
Related Pages
HTML DOM reference: TouchEvent targetTouches Property
More Examples
Example
Return the x- and y-coordinates of the touch:
function showCoordinates(event) {
var x = event.touches[0].clientX;
var y = event.touches[0].clientY;
}
Try it Yourself »
Browser Support
event.touches
is a DOM Level 3 (2004) feature.
It is fully supported in all modern browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | 11 |