JavaScript Element pointermove Event

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

What You’ll Learn

The pointermove event fires when a pointer changes coordinates (and is not canceled by touch-action). Learn addEventListener vs onpointermove, how it compares to mousemove, high fire-rate tips, drag with setPointerCapture, and five try-it labs.

01

Kind

Instance event

02

Type

PointerEvent

03

When

Coordinates change

04

Handler

onpointermove

05

Buttons?

Optional (hover too)

06

Status

Baseline widely available

Introduction

pointermove answers: “Did this pointer change position?” It is the unified cousin of mousemove—with extra fields for touch contact size, pen pressure, and pointer identity.

MDN notes moves fire whether or not buttons are pressed, and they can arrive at a very high rate. Keep handlers light, or throttle expensive work (drawing, layout, network).

💡
Beginner tip

If the browser claims the gesture for scrolling/zooming (touch-action, pointermove may not be delivered. On drag surfaces, set touch-action: none when you need full control.

Understanding pointermove

An instance event that answers: “Did the pointer’s coordinates change?”

  • Coordinates — fires when the pointer moves (hover or pressed).
  • touch-action — browser gestures can cancel delivery of moves.
  • High rate — expect many events during a fast swipe or mouse glide.
  • vs mousemove — similar timing for mouse; PointerEvent adds id, type, pressure, etc.
  • Baseline Widely available on MDN (since July 2020).

📝 Syntax

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

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

onpointermove = (event) => { };

Event type

A PointerEvent (inherits from MouseEvent and Event).

Handy properties

PropertyMeaning
clientX / clientYPointer position in the viewport
movementX / movementYDelta since the previous move event
pointerIdUnique id for this pointer stream
pointerTypemouse, pen, touch, etc.
pressure / buttonsPressure (when available) and pressed button bitmask

⚖️ pointermove vs mousemove

Topicpointermovemousemove
Input modelMouse, touch, and penMouse (compatibility path)
Event typePointerEventMouseEvent
Extra fieldspointerId, pressure, widthClassic mouse fields
Buttons required?No (hover moves count)No (hover moves count)
Best forUnified drag / draw / hover trackingLegacy mouse-only code

⚡ High Fire Rate Tips

  • Do not write to the DOM on every move if you can update once per animation frame.
  • Prefer reading clientX / clientY (or deltas) and batch paint work with requestAnimationFrame.
  • For drag, call setPointerCapture on pointerdown so moves keep targeting your handle.
  • Always clear drag state on pointerup and pointercancel.

⚡ Quick Reference

GoalCode / note
Listenel.addEventListener("pointermove", fn)
Handler propertyel.onpointermove = fn
Positionevent.clientX, event.clientY
Drag movessetPointerCapture on pointerdown
Touch controltouch-action: none on the surface
MDN statusBaseline Widely available (Jul 2020)

🔍 At a Glance

Four facts to remember about pointermove.

Event type
PointerEvent

MouseEvent + more

Means
coords changed

Hover or pressed

Rate
very high

Keep handlers light

Baseline
yes

Since Jul 2020

Examples Gallery

Examples follow MDN Element: pointermove event. Move a mouse, pen, or finger over the stage elements.

📚 Getting Started

MDN listener patterns and the handler property.

Example 1 — Log pointermove (MDN)

Fire whenever the pointer moves over the paragraph.

JavaScript
const para = document.querySelector("p");
const out = document.getElementById("out");

para.addEventListener("pointermove", (event) => {
  out.textContent = "Pointer moved";
});
Try It Yourself

How It Works

Each coordinate change can call the listener again—expect a stream of updates while moving.

Example 2 — onpointermove Property (MDN)

Same idea using the handler property form.

JavaScript
const para = document.querySelector("p");
const out = document.getElementById("out");

para.onpointermove = (event) => {
  out.textContent = "onpointermove at " + event.clientX + "," + event.clientY;
};
Try It Yourself

How It Works

Prefer addEventListener when you need multiple listeners or easy removal.

📈 Coords, Drag & Pressure

Track live position, drag with capture, and read pressure/type.

Example 3 — Live Coordinates + Count

Show position and how many move events arrive.

JavaScript
const stage = document.getElementById("stage");
const out = document.getElementById("out");
let count = 0;

stage.addEventListener("pointermove", (event) => {
  count++;
  out.textContent =
    "x=" + event.clientX +
    " y=" + event.clientY +
    " moves=" + count;
});
Try It Yourself

How It Works

The rising moves count shows why MDN warns about high fire rates.

Example 4 — Drag with setPointerCapture

Capture on down, update position on move, clear on up/cancel.

JavaScript
const handle = document.getElementById("handle");
const out = document.getElementById("out");
let dragging = false;

handle.addEventListener("pointerdown", (event) => {
  dragging = true;
  handle.setPointerCapture(event.pointerId);
  handle.classList.add("is-dragging");
});

handle.addEventListener("pointermove", (event) => {
  if (!dragging) return;
  out.textContent = "drag @" + event.clientX + "," + event.clientY;
});

function endDrag() {
  dragging = false;
  handle.classList.remove("is-dragging");
  out.textContent = "idle";
}

handle.addEventListener("pointerup", endDrag);
handle.addEventListener("pointercancel", endDrag);
Try It Yourself

How It Works

Capture keeps pointermove on the handle even if the pointer leaves its box.

Example 5 — Type + Pressure

Log device type and pressure while moving (pen-friendly).

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

stage.addEventListener("pointermove", (event) => {
  out.textContent =
    "type=" + event.pointerType +
    " pressure=" + event.pressure.toFixed(2) +
    " buttons=" + event.buttons;
});
Try It Yourself

How It Works

Mice often report pressure as 0 when hovering and 0.5 when a button is down; pens report richer values.

🚀 Common Use Cases

  • Drag, resize, and draw tools for mouse, touch, and pen.
  • Follow-cursor UI (crosshairs, tooltips that track position).
  • Read pressure / tilt for stylus drawing apps.
  • Combine with setPointerCapture so moves stay on your control.
  • Replace mouse-only mousemove when you need one code path for all pointers.

🔧 How It Works

1

Pointer present

Hovering or contacting the element (optionally after capture).

Active stream
2

Coordinates change

User moves; browser may still own the gesture via touch-action.

Input
3

pointermove

PointerEvent delivers position, id, type, pressure, and more.

Event
4

Update UI lightly

Read coords; batch heavy paint with requestAnimationFrame.

📝 Notes

  • MDN: Baseline Widely available (since July 2020) — no Deprecated / Experimental / Non-standard banner.
  • Fires with or without buttons pressed; rate can be very high.
  • Browser touch-action can prevent move delivery for that contact.
  • For drag, pair pointerdown capture with pointerup / pointercancel cleanup.
  • Related learning: pointerleave, pointerout, pointerdown, addEventListener(), JavaScript hub.

Browser Support

pointermove is marked Baseline Widely available on MDN (since July 2020). Logos use the shared browser-image-sprite.png sprite from this project. Pointer Events unify mouse, touch, and pen across modern engines.

Baseline · Widely available

Element pointermove

Fires when a pointer changes coordinates; keep handlers light and respect touch-action on mobile.

Full Widely available
Google Chrome Full support
Yes
Mozilla Firefox Full support
Yes
Apple Safari Full support
Yes
Microsoft Edge Full support
Yes
Opera Full support
Yes
Internet Explorer Pointer Events (legacy IE11 path)
Partial
pointermove Baseline

Bottom line: Prefer pointermove for unified tracking. Use setPointerCapture for drag and throttle expensive work.

Conclusion

pointermove is the unified “pointer coordinates changed” signal. Use it for tracking, drag, and drawing—keep handlers light, respect touch-action, and end gestures on pointerup / pointercancel.

Continue with pointerout, pointerleave, pointerdown, or the JavaScript hub.

💡 Best Practices

✅ Do

  • Prefer pointermove for unified mouse/touch/pen tracking
  • Keep move handlers cheap; batch paint with requestAnimationFrame
  • Use setPointerCapture for drag that leaves the hit box
  • Set touch-action: none on dedicated drag surfaces
  • Clear state on both pointerup and pointercancel

❌ Don’t

  • Do heavy DOM or network work on every move event
  • Assume moves always fire during touch scroll (touch-action may cancel them)
  • Forget capture when the pointer leaves your handle mid-drag
  • Ignore cancel paths on mobile / stylus devices
  • Overwrite onpointermove if you need multiple listeners

Key Takeaways

Knowledge Unlocked

Five things to remember about pointermove

Coordinates changed—fast, unified tracking for mouse, touch, and pen.

5
Core concepts
📄02

PointerEvent

id · type · pressure

API
03

High rate

keep work light

Perf
🔓04

Capture

reliable drag

Pattern
🎯05

Baseline

since Jul 2020

Status

❓ Frequently Asked Questions

It fires when a pointer changes coordinates and has not been canceled by a browser touch-action. It is very similar to mousemove, but with more PointerEvent features for mouse, touch, and pen.
No. MDN marks Element pointermove as Baseline Widely available (since July 2020). It is not Deprecated, Experimental, or Non-standard.
A PointerEvent (inherits from MouseEvent and Event). Useful fields include pointerId, pointerType, pressure, clientX/clientY, and movementX/movementY.
No. MDN notes these events happen whether or not any pointer buttons are pressed—so mouse hover moves still fire pointermove.
It can fire at a very high rate depending on how fast the user moves, how fast the machine is, and what else is running. Keep handlers light or throttle heavy work.
If the browser uses the gesture for scrolling or zooming (CSS touch-action), pointermove may not be delivered for that contact. Use touch-action: none on drag surfaces when you need full pointer control.
Did you know?

Spec tables list pointermove as bubbling and cancelable. When the pointer is primary, canceling can also affect related mouse compatibility default actions—another reason Pointer Events are more than a rename of mouse events.

Next: pointerout

Learn the bubbling leave event and how it differs from pointerleave.

pointerout →

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