Get Mouse Position in JavaScript ('x' and 'y') - JavaScript Tutorial For Beginners

Published: 30 December 2017
on channel: dcode
56,248
911

Source code on CodePen:
https://codepen.io/dcode-software/pen...

Through using the MouseEvent object, you are able to access the 'x' and 'y' properties, giving you the position of the mouse when that event fired off.

In this video we look at using the 'mousemove' event on the Window object, allowing us to constantly update the x and y coordinates in the browser as the mouse moves across.

If this video helped you out and you'd like to see more, make sure to leave a like and subscribe to dcode!


Watch video Get Mouse Position in JavaScript ('x' and 'y') - JavaScript Tutorial For Beginners online without registration, duration hours minute second in high quality. This video was added by user dcode 30 December 2017, don't forget to share it with your friends and acquaintances, it has been viewed on our site 56,248 once and liked it 911 people.