TouchEvent touches Property
Definition and Usage
The 'touches' property returns an array of Touch objects, with each object corresponding to a finger on the current touch surface.
Note:This property is read-only.
Instance
Example 1
Determine how many fingers are touching the surface:
function countTouches(event) { var x = event.touches.length; }
Example 2
Return the x and y coordinates of the touch:
function showCoordinates(event) { var x = event.touches[0].clientX; var y = event.touches[0].clientY; }
Syntax
event.touches
Technical Details
Return Value: | Array of Touch Objects. |
---|
Browser Support
The numbers in the table indicate the first browser version that fully supports the property.
Properties | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
touches | 22 | Supported | 52 | Not Supported | Not Supported |
Related Pages
HTML DOM Reference Manual:TouchEvent targetTouches Property