JavaScript Element touchmove Event

Beginner
⏱️ 11 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
DOM event
Instance event

What You’ll Learn

The touchmove event fires when one or more touch points move along the surface. Learn TouchEvent, changedTouches, passive listeners, drag patterns, Pointer Events alternatives, and five try-it labs.

01

Kind

Instance event

02

Type

TouchEvent

03

When

Finger slides

04

Handler

ontouchmove

05

Bubbles?

Yes

06

Status

Limited availability

Introduction

After touchstart, sliding a finger fires touchmove repeatedly. That is the signal for custom drag, swipe tracking, and ink-style drawing on touch devices.

Like other touch events, it can fire at a high rate. Keep handlers light, prefer { passive: true } when you do not call preventDefault(), and consider pointermove for mouse + pen + touch together.

💡
Beginner tip

Calling preventDefault() on touchmove can stop page scrolling. Only do that for intentional custom gestures, and pair with touch-action CSS when you can.

Understanding touchmove

An instance event that answers: “Did one or more fingers move on the surface?”

  • Trigger — touch points move along the surface.
  • Event typeTouchEvent; use changedTouches.
  • Bubbles — yes; cancelable when you need to block default gestures.
  • High rate — keep work cheap; throttle paint if needed.
  • Limited availability on MDN (not Baseline)—desktop Safari often lacks Touch Events.

⚡ Passive Listeners & Scrolling

  • Default recommendation: addEventListener("touchmove", fn, { passive: true }).
  • Use a non-passive listener only when you must call preventDefault().
  • CSS touch-action: none (or pan-x / pan-y) can declare intent without fighting every move event.

📝 Syntax

Use the event name with addEventListener, or set the handler property:

JavaScript
addEventListener("touchmove", (event) => { });

ontouchmove = (event) => { };

Event type

A TouchEvent (inherits from UIEvent / Event).

Handy TouchEvent properties

PropertyMeaning
changedTouchesTouch points that moved since the last event
touchesAll current contacts on the surface
targetTouchesContacts that started on this target and are still down
altKey / ctrlKey / metaKey / shiftKeyModifier keys at event time

⚡ Quick Reference

GoalCode / note
Listen (passive)el.addEventListener("touchmove", fn, { passive: true })
Handler propertyel.ontouchmove = fn
Moved pointsevent.changedTouches
PositionchangedTouches[0].clientX / clientY
Custom dragtouch-action: none + move handler
MDN statusLimited availability (not Baseline)

🔍 At a Glance

Four facts to remember about touchmove.

Event type
TouchEvent

changedTouches

Means
sliding

High fire rate

Default tip
passive

Prefer true

Baseline
no

Limited availability

Examples Gallery

Patterns follow MDN Element: touchmove event and the Touch events guide. Use a touch device or DevTools touch simulation; some labs include mouse fallbacks for desktop practice.

📚 Getting Started

Listen for slide and read coordinates.

Example 1 — Log touchmove Position

Print clientX / clientY while the finger slides.

JavaScript
const pad = document.getElementById("pad");
const out = document.getElementById("out");

pad.addEventListener("touchmove", (event) => {
  const t = event.changedTouches[0];
  if (!t) return;
  out.textContent =
    "x=" + Math.round(t.clientX) +
    " y=" + Math.round(t.clientY);
}, { passive: true });
Try It Yourself

How It Works

changedTouches holds the points that moved. passive: true keeps scrolling smooth when you only observe.

Example 2 — ontouchmove Property

Same idea using the handler property form.

JavaScript
const pad = document.getElementById("pad");
const out = document.getElementById("out");

pad.ontouchmove = (event) => {
  out.textContent = "ontouchmove · n=" + event.changedTouches.length;
};
Try It Yourself

How It Works

Prefer addEventListener when you need multiple listeners, options like passive, or easy removal.

📈 Drag, Count & Detect

Follow the finger, see fire rate, and feature-detect.

Example 3 — Drag a Dot with the Finger

Move a marker to match the first changedTouches point.

JavaScript
const pad = document.getElementById("pad");
const dot = document.getElementById("dot");

function moveDot(clientX, clientY) {
  const r = pad.getBoundingClientRect();
  const x = clientX - r.left;
  const y = clientY - r.top;
  dot.style.left = x + "px";
  dot.style.top = y + "px";
}

pad.addEventListener("touchmove", (event) => {
  const t = event.changedTouches[0];
  if (t) moveDot(t.clientX, t.clientY);
}, { passive: true });
Try It Yourself

How It Works

Convert viewport coordinates to pad-local positions with getBoundingClientRect().

Example 4 — Count touchmove Fires

See how many move events arrive during one slide.

JavaScript
const pad = document.getElementById("pad");
const out = document.getElementById("out");
let n = 0;

pad.addEventListener("touchstart", () => {
  n = 0;
  out.textContent = "moves=0";
}, { passive: true });

pad.addEventListener("touchmove", () => {
  n += 1;
  out.textContent = "moves=" + n;
}, { passive: true });
Try It Yourself

How It Works

One gesture can produce many move events—why heavy DOM work belongs outside the raw handler (or throttled).

Example 5 — Feature Detect + Pointer Fallback Note

Check Touch Events support; prefer Pointer Events when building new UIs.

JavaScript
const out = document.getElementById("out");
const hasTouch = "ontouchmove" in window;

out.textContent = hasTouch
  ? "Touch Events available — listen for touchmove"
  : "No Touch Events — use Pointer Events (pointermove)";

if (hasTouch) {
  document.getElementById("pad").addEventListener(
    "touchmove",
    () => { out.textContent = "touchmove received"; },
    { passive: true }
  );
}
Try It Yourself

How It Works

Many desktop browsers hide Touch Events even with a touchscreen—feature-detect and plan a Pointer Events path.

🚀 Common Use Cases

  • Custom drag-and-drop and slider thumbs on touch devices.
  • Swipe / pan tracking for carousels (often with touch-action).
  • Drawing / signature pads that follow the finger.
  • Live position feedback while a gesture is in progress.
  • Migrating toward pointermove for mouse + pen + touch.

🔧 How It Works

1

Touch starts

touchstart places one or more contacts on the surface.

Down
2

Finger slides

Contact position updates as the user moves.

Motion
3

touchmove fires

TouchEvent with changedTouches for moved points (often many times).

Event
4

Update UI lightly

Move markers, track swipe delta; finish on touchend / touchcancel.

📝 Notes

  • MDN: Limited availability (not Baseline)—no Deprecated / Experimental / Non-standard banner.
  • Prefer { passive: true } unless you must call preventDefault().
  • Desktop Safari often lacks Touch Events; test on iOS Safari / Android browsers.
  • Prefer Pointer Events for new cross-device interaction code.
  • Related learning: touchend, touchcancel, pointermove, addEventListener(), JavaScript hub.

Limited Browser Availability

touchmove is marked Limited availability on MDN (not Baseline). Logos use the shared browser-image-sprite.png sprite from this project. Touch Events are strong on mobile; many desktop browsers omit them—prefer Pointer Events for cross-device UIs.

Limited availability

Element touchmove

Fires while touch points move. Chrome 22+, Firefox 52+, Edge 12+, Safari iOS yes; desktop Safari often no.

Partial Not Baseline
Google Chrome 22+ (touch-capable / mobile)
Supported
Mozilla Firefox 52+ (desktop re-enabled)
Supported
Apple Safari iOS yes · desktop often no
Partial
Microsoft Edge 12+
Supported
Opera Mobile / Chromium touch paths
Partial
Internet Explorer Not supported (use Pointer Events)
Unavailable
touchmove Limited

Bottom line: Use passive touchmove for observation, touch-action for custom drag, and prefer pointermove for mouse + pen + touch together.

Conclusion

touchmove is the continuous “finger sliding” signal in the Touch Events API. Read changedTouches, keep handlers light and usually passive, finish with touchend / touchcancel, and consider Pointer Events for cross-device UIs.

Continue with touchstart, touchend, pointermove, addEventListener(), or the JavaScript hub.

💡 Best Practices

✅ Do

  • Use { passive: true } when you only read positions
  • Read move data from changedTouches
  • Keep drag math cheap; throttle heavy paint if needed
  • Pair with touchend and touchcancel
  • Prefer Pointer Events for new multi-input UIs

❌ Don’t

  • Call preventDefault() on every move unless you must
  • Do heavy layout thrashing inside the raw handler
  • Assume desktop Safari exposes Touch Events
  • Detect “mobile” only by checking for ontouchstart
  • Overwrite ontouchmove if you need multiple listeners

Key Takeaways

Knowledge Unlocked

Five things to remember about touchmove

Finger sliding—observe lightly, drag carefully, prefer pointers for new UIs.

5
Core concepts
📄02

TouchEvent

changedTouches

API
03

Passive

prefer true

Perf
👆04

Drag

follow clientX/Y

Pattern
🎯05

Limited

prefer pointermove

Status

❓ Frequently Asked Questions

It fires when one or more touch points move along the touch surface—continuously while the finger slides.
No. MDN does not mark Element touchmove as Deprecated, Experimental, or Non-standard. It has Limited availability (not Baseline), mainly because desktop Safari and some desktop browsers omit or limit Touch Events.
A TouchEvent. Use changedTouches for the points that moved; also inspect touches and targetTouches as needed.
touchmove can fire at a high rate. A non-passive listener that calls preventDefault can block scrolling. Prefer { passive: true } unless you must prevent the browser’s default scroll/zoom.
touchmove is Touch Events only. pointermove works for mouse, pen, and touch. For new cross-device UIs, prefer Pointer Events.
The touch-action property can limit which gestures the browser handles (pan, zoom). It often pairs with custom drag code that listens for touchmove.
Did you know?

Browsers may treat document-level touchmove listeners as passive by default for scroll performance. If you need preventDefault(), register with { passive: false } explicitly and only on the element that needs it.

Next: touchstart

Handle the finger-down start of a Touch Events gesture.

touchstart →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful