Posted By

Juego on 07/19/08


Tagged

jquery mouse


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

rikaizm
rafael
philokezzar


jQuery - get mouse position


 / Published in: JavaScript
 

URL: http://www.lupaworld.com/89596/viewspace_32961.html

  1. var mouseX = 0;
  2. var mouseY = 0;
  3. $().mousemove( function(e) {
  4. mouseX = e.pageX;
  5. mouseY = e.pageY;
  6. });

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: nbsp on July 31, 2008

or so:

var mouseX = mouseY = 0; $().mousemove(function(e) { mouseX = e.pageX; mouseY = e.pageY; });

Posted By: Uzbekjon on July 2, 2009

To understand how it works and learn more about getting mouse positions with jQuery read this article here:

http://jquery-howto.blogspot.com/2009/07/identifying-locating-mouse-position-in.html

It explains the above jquery code snippet and gives some more examples.

You need to login to post a comment.