TouchEvent targetTouches Property
Example
Find out how many fingers that touches an element:
function countTouches(event) {
var x = event.targetTouches.length;
}
Try it Yourself »
Definition and Usage
The targetTouches property returns an array of Touch objects, one for each finger that is touching the current target element.
Note: This property is read-only.
Browser Support
Property | |||||
---|---|---|---|---|---|
targetTouches | 22 | yes | 52 | Not supported | Not supported |
Syntax
event.targetTouches
Technical Details
Return Value: | An Array of Touch objects. |
---|
Related Pages
HTML DOM reference: TouchEvent touches Property
More Examples
Example
Return the tag name of the current element:
function getTagname(event) {
var x = event.touches[0].clientX;
var y = event.touches[0].clientY;
}
Try it Yourself »