Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. TouchEvent
  4. targetTouches

TouchEvent: targetTouches property

Limited availability

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

ThetargetTouches read-only property is aTouchList listing all theTouch objects for touch points that are still in contact with the touch surfaceand whosetouchstart event occurred inside the same targetelement as the current target element.

Value

ATouchList listing all theTouch objects for touch points that are still in contact with the touch surfaceand whosetouchstart event occurred inside the same targetelement as the current target element.

Examples

This example illustrates theTouchEvent object'sTouchEvent.targetTouches property. TheTouchEvent.targetTouches property is aTouchList object that includes those TPs that are currently touching the surfaceand started on the element that is the target of the current event. As such, thetargetTouches list is a strict subset of thetouches list.

In following code snippet, the function compares the length of thetouches list to the length of thetargetTouches list and returnstrue if the lengths are the same and returnsfalse otherwise.

js
function touchesInTarget(ev) {  // Return true if all of the touches are within the target element;  // otherwise return false.  return ev.touches.length === ev.targetTouches.length;}

Specifications

Specification
Touch Events
# dom-touchevent-targettouches

Browser compatibility

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp