tencent cloud

All product documents
Tencent Cloud Super App as a Service
Last updated: 2025-04-10 18:18:36
Touch
Last updated: 2025-04-10 18:18:36

onTouchStart

This API is called using wx.onTouchStart(function listener).
Feature description:Listens for the start of a touch event.
Parameter and description: function listener. The function that handles the touch start event. Parameters are as follows:
Property
Type
Description
touches
Array.<Touch>
List of all current touch points.
changedTouches
Array.<Touch>
List of touch points that triggered this event.
timeStamp
number
Timestamp when the event was triggered.

onTouchMove

This API is called using wx.onTouchMove(function listener).
Feature description:Listens for touch move event.
Parameter and description: function listener. The function that handles the touch move event. Parameters are as follows:
Property
Type
Description
touches
Array.<Touch>
List of all current touch points.
changedTouches
Array.<Touch>
List of touch points that triggered this event.
timeStamp
number
Timestamp when the event was triggered.

onTouchEnd

This API is called using wx.onTouchEnd(function listener).
Feature description:Listens for the end of a touch event.
Parameter and description: function listener. The function that handles the touch end event. Parameters are as follows:
Property
Type
Description
touches
Array.<Touch>
List of all current touch points.
changedTouches
Array.<Touch>
List of touch points that triggered this event.
timeStamp
number
Timestamp when the event was triggered.

onTouchCancel

This API is called using wx.onTouchCancel(function listener).
Feature description:Listens for touch cancel event.
Parameter and description: function listener. The function that handles the touch cancel event. Parameters are as follows:
Property
Type
Description
touches
Array.<Touch>
List of all current touch points.
changedTouches
Array.<Touch>
List of touch points that triggered this event.
timeStamp
number
Timestamp when the event was triggered.

offTouchStart

This API is called using wx.offTouchStart(function listener).
Feature description:Removes the listener for the touch start event.
Parameter and description: function listener. The function that was passed to onTouchStart. If not provided, all listeners will be removed.
Example:
const listener = function (res) { console.log(res) }

wx.onTouchStart(listener)
wx.offTouchStart(listener) // Must pass the same function object used in onTouchStart

offTouchMove

This API is called using wx.offTouchMove(function listener).
Feature description:Removes the listener for the touch move event.
Parameter and description: function listener. The function that was passed to onTouchMove. If not provided, all listeners will be removed.
Example:
const listener = function (res) { console.log(res) }

wx.onTouchMove(listener)
wx.offTouchMove(listener) // Must pass the same function object used in onTouchMove

offTouchEnd

This API is called using wx.offTouchEnd(function listener).
Feature description: Removes the listener for the touch end event.
Parameter and description: function listener. The function that was passed to onTouchEnd. If not provided, all listeners will be removed.
Example:
const listener = function (res) { console.log(res) }

wx.onTouchEnd(listener)
wx.offTouchEnd(listener) // Must pass the same function object used in onTouchEnd

offTouchCancel

This API is called using wx.offTouchCancel(function listener).
Feature description:Removes the listener for the touch cancel event.
Parameter and description: function listener. The function that was passed to onTouchCancel. If not provided, all listeners will be removed.
Example:
const listener = function (res) { console.log(res) }

wx.onTouchCancel(listener)
wx.offTouchCancel(listener) // Must pass the same function object used in onTouchCancel

Touch

A touch point on a touch-sensitive device. It typically refers to a finger or stylus on a touchscreen or touchpad.

Property

number identifier

Unique identifier of a touch object, read-only. This identifier remains constant throughout the entire touch movement, allowing you to track whether it is the same touch point.

number pageX

The X-coordinate of the touch point relative to the left edge of the page.

number pageY

The Y-coordinate of the touch point relative to the top edge of the page.

number clientX

The X-coordinate of the touch point relative to the left edge of the visible viewport.

number clientY

The Y-coordinate of the touch point relative to the top edge of the visible viewport.

number force

The amount of pressure being applied to the touch surface, ranging from 0.0 (no pressure) to 1.0 (maximum pressure). This property is only available on devices that support force touch.

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 available.

7x24 Phone Support