Code has been added to clipboard!

Track Mouse Position with pageY and pageX Properties

Reading time 1 min
Published Jul 3, 2019
Updated Sep 30, 2019

pageY and pageX: Main Tips

  • The event.pageY property returns the cursor position in relation to document's top edge (in pixels).
  • To find out the position in relation to the document's left edge, use event.pageX property.
Udacity
Pros
  • Simplistic design (no unnecessary information)
  • High-quality courses (even the free ones)
  • Variety of features
Main Features
  • Nanodegree programs
  • Suitable for enterprises
  • Paid certificates of completion
Coursera
Pros
  • Professional service
  • Flexible timetables
  • A variety of features to choose from
Main Features
  • Professional certificates of completion
  • University-level courses
  • Multiple Online degree programs
Datacamp
Pros
  • Great user experience
  • Offers quality content
  • Very transparent with their pricing
Main Features
  • Free certificates of completion
  • Focused on data science skills
  • Flexible learning timetable

pageY

The event.pageY property returns the cursor position relative to the top edge. In the example below, you can see how the page Y tracks your mouse movements:

pageX

Now, by using the event.pageX property you can get the cursor position relative to the left edge. Open the example below and move your mouse to see how the cursor position is indicated in pixels:

Note: both pageX and pageY only track the movement inside the document frame.

Latest Udacity Coupon Found:

Verified STAFF PICK

75% OFF COURSES

Udacity Black Friday Offer

The best time to save on Udacity courses is now - follow this coupon to access a 75% Udacity Black Friday discount & enjoy learning at a very low cost!

Expiration date: 30/01/2021
3176 People Used
Only 97 Left
Rating
5.0