jQuery event.pageY Property

Beginner
5 min read
Updated: Nov 2026
3 examples
Events

Definition

event.pageY is a Number on the jQuery event object. It is the mouse pointer’s vertical position in pixels relative to the top edge of the document (scroll included). Added in jQuery 1.0.4. Pair it with event.pageX for a full document (x, y) point.

Syntax

Start with these common calls. Keep them short and readable.

jQuery
event.pageY   // Number — px from document top (read-only)

$(document).on("mousemove", function (event) {
  // pageX: horizontal · pageY: vertical
  console.log(event.pageX, event.pageY);
});

pageY   → document coordinates (includes scroll)
clientY → viewport coordinates (visible window)
offsetY → relative to the event target element
CallWhat it does
event.pageYLearn jQuery event.pageY: vertical mouse position relative to the document top edge, official mousemove demo with pageX, pageY vs clientY, click coordinates, examples, pitfalls, and FAQs.

Load jQuery before your script (CDN or local file), then wrap DOM work in $(function () { ... }) when needed.

Parameters

ParameterDescription
Step 1Choose a mouse event (mousemove, click, mousedown, …).
Step 2Bind with .on("mousemove", handler) (or click / mousedown).
Step 3Inside the handler, read event.pageY — pixels from the document’s top edge.

Return Value

Return ValueDescription
Value / undefinedGetters usually return a value from the first matched element, or undefined when nothing applies.

jQuery Examples

Example 1 — Official Demo: Log pageX / pageY

On mousemove, show both document coordinates (official idea).

jQuery
$(document).on("mousemove", function (event) {
  $("#out").text(
    "pageX: " + event.pageX + ", pageY: " + event.pageY
  );
});
Try It Yourself

How It Works

  1. Bind. mousemove on document catches moves anywhere on the page.
  2. Read X. event.pageX is distance from the document’s left edge.
  3. Read Y. event.pageY is distance from the document’s top edge.

Example 2 — Click Coordinates

Capture where the user clicked using pageY (and pageX).

jQuery
$(document).on("click", function (event) {
  $("#out").text(
    "Clicked at pageX: " + event.pageX +
    ", pageY: " + event.pageY
  );
});
Try It Yourself

How It Works

  1. Bind click. One handler for any click on the page.
  2. Read. pageX / pageY are the click point in document space.
  3. Show. Write the pair into #out.

Example 3 — pageY vs clientY

Document coordinates include scroll; viewport coordinates do not.

jQuery
$(document).on("click", function (event) {
  $("#out").text(
    "pageY: " + event.pageY + " (document)\n" +
    "clientY: " + event.clientY + " (viewport)\n" +
    "scrollY: " + window.scrollY
  );
});
Try It Yourself

How It Works

  1. pageY. Measured from the document’s top edge.
  2. clientY. Measured from the viewport’s top edge.
  3. Scroll. When scrollY > 0, pageY is larger than clientY.

Frequently Asked Questions

event.pageY is a Number on the jQuery event object. It is the mouse pointer’s vertical position in pixels relative to the top edge of the document — including any vertical scroll. Available since jQuery 1.0.4 on mouse events such as mousemove, click, and mousedown.
clientY is relative to the browser viewport (visible window). pageY includes document scroll — roughly pageY ≈ clientY + window.scrollY. Use pageY for document-wide coordinates; clientY for viewport-fixed UI.
pageY is vertical (from the document’s top edge). pageX is horizontal (from the document’s left edge). Together they form a (x, y) point in document space — the official jQuery demo logs both on mousemove.
Mouse events expose pageY — mousemove, mouseenter, mouseleave, mouseover, mouseout, mousedown, mouseup, and click. Keyboard events do not carry a meaningful pointer pageY.
No. pageY is read-only — the browser sets it from the pointer when the event fires. Read pageY and apply it to your own variables or element positions.
pageY is relative to the entire document. offsetY is relative to the event target’s padding edge. Use pageY for absolute document positioning; offsetY for clicks inside a specific box.

Next: event.relatedTarget Property

See the other element involved in mouseover and mouseout events.

event.relatedTarget Property tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

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.

9 people found this page helpful