touchmove event

Definition and usage

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

The touchmove event triggers every 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: Alle HTML elementer

Browsertilpasning

Tal i tabellen angiver den første browserversion, der fuldt ud understøtter denne begivenhed.

Begivenheder Chrome IE Firefox Safari Opera
touchmove 22.0 12.0 52 Ikke understøttet Ikke understøttet