touchmove event

Definition and usage

A touchmove event occurs when the user moves their finger on the screen.

The touchmove event is triggered each time the finger moves and continues to trigger until the finger is released.

Tip:Here are other events related to the touchmove event:

  • touchstart - Occurs when the user touches the element:
  • touchend - Occurs when the user removes their finger from the element:
  • touchcancel - Occurs when the user moves their finger on the screen:

Example

Execute JavaScript when the user moves their finger over the P element (only for touchscreens):

<p ontouchmove="myFunction(event)">Touch me!</p>

Try it yourself

Syntax

In HTML:

<element ontouchmove="myScript">

Try it yourself

In JavaScript:

object.ontouchmove = myScript;

Try it yourself

In JavaScript, use the addEventListener() method:

object.addEventListener("touchmove", myScript);

Try it yourself

Technical details

Bubbling: Supported
Cancelable: Supported
Event types: TouchEvent
Supported HTML tags: All HTML Elements

Browser Support

The numbers in the table indicate the first browser version that fully supports the event.

Event Chrome IE Firefox Safari Opera
touchmove 22.0 12.0 52 Not Supported Not Supported