touchmove Event

Example

Call a function when the user moves the finger over a P element (for touch screens only):

<p ontouchmove="myFunction(event)">Touch me!</p>
Try it Yourself »

Description

The touchmove event occurs when a user moves a finger across the screen.

The touchmove event only works on touch screens.

The touchmove event is triggered once for each movement and continues until the finger is released.

Touch Events

EventOccurs When
touchstartThe user touches an element
touchmoveThe user moves the finger across the screen
touchendThe user removes the finger from an element
touchcancelThe touch is interrupted

Events that are triggered from the user interface belongs to the UiEvent Object.

UiEvent Properties

Property Description
detail A number with details about the event
view A reference to the Window object where the event occurred

See Also:

The IU Event Object
The Touch Event Object



Syntax

In HTML:

<element ontouchmove="myScript">
Try it Yourself »

In JavaScript:

object.ontouchmove = myScript;
Try it Yourself »

In JavaScript, using the addEventListener() method:

object.addEventListener("touchmove", myScript);
Try it Yourself »

Technical Details

Bubbles: Yes
Cancelable: Yes
Event type: TouchEvent
HTML tags: All HTML elements

Browser Support

ontouchmove is a DOM Level 4 (2015) feature.

It is supported in all modern browsers:

Chrome Edge Firefox Safari Opera
Yes Yes Yes Yes Yes

ontouchmove is not supported in Internet Explorer 11 (or earlier).



Copyright 1999-2023 by Refsnes Data. All Rights Reserved.