Safari Developer Library

Developer

Touch Class Reference

Options
Deployment Target:

On This Page

Touch

A Touch object represents a single user touch on the screen of the device. A touch is the presence or movement of a finger and is part of a unique multi-touch sequence. Use the changedTouches method to get all the touch objects that changed in a TouchEvent object.

Starting in iOS 9, on devices that support 3D Touch, you can get the force property of the Touch class to obtain a value representing the force at which the user is pressing on the screen. For more information about 3D Touch, see Adopting 3D Touch on iPhone.

  • target Property

    The target of this touch.

    Declaration

    readonly attribute EventTarget target

  • identifier Property

    The unique identifier for this touch object.

    Declaration

    readonly attribute unsigned long identifier

  • clientX Property

    The x-coordinate of the touch’s location relative to the window’s viewport.

    Declaration

    readonly attribute long clientX

  • clientY Property

    The y-coordinate of the touch’s location relative to the window’s viewport.

    Declaration

    readonly attribute long clientY

  • pageX Property

    The x-coordinate of the touch’s location in page coordinates.

    Declaration

    readonly attribute long pageX

  • pageY Property

    The y-coordinate of the touch’s location in page coordinates.

    Declaration

    readonly attribute long pageY

  • screenX Property

    The x-coordinate of the touch’s location in screen coordinates.

    Declaration

    readonly attribute long screenX

  • screenY Property

    The y-coordinate of the touch’s location in screen coordinates.

    Declaration

    readonly attribute long screenY

  • force Property

    The force of the touch, using a positive linear scale where a value of 0.0 indicates the absence of force.

    Declaration

    readonly attribute double force