Web APIs

Touch Events

Checking compatibility...

The Touch Events API provides interfaces for handling touch events on touchscreen devices. It enables web applications to respond to finger (or stylus) movements on touch screens, including multi-touch gestures.

Basic Touch Events

Detect when users touch, move their finger, and lift off the screen. This example shows how to track a single touch point from start to finish, which is essential for creating responsive buttons, sliders, and other interactive elements that feel natural on touchscreens.

=
=
=
=
=
=

Output

Click Run to see output...

Multi-touch Drawing

Handle multiple fingers touching the screen simultaneously. This example demonstrates how to track each touch point individually in a TouchList, allowing you to create multi-touch experiences like drawing apps, virtual keyboards, or gaming controls.

=
=
=
=
=
=

Output

Click Run to see output...

Touch Gestures

Recognize common touch patterns like pinching, zooming, and swiping. This example shows how to calculate the distance and angle between touch points to implement intuitive gestures for manipulating content, navigating interfaces, or controlling game elements.

=
=
=
=
=
=

Output

Click Run to see output...