Example 1 — Log pageX / pageY
Append coordinates each time the pointer moves over the target — the official .on("mousemove") pattern.
$("#target").on("mousemove", function (event) {
var msg = "Handler for mousemove called at ";
msg += event.pageX + ", " + event.pageY;
$("#log").append(msg + "\n");
}); How It Works
- Bind the event.
.on("mousemove", fn)registers the handler on#target. - Move inside the element. Each pixel of movement calls the function.
- Read document coords. jQuery provides normalized
pageXandpageY.

