We Recommend

Pro JavaScript Techniques Pro JavaScript Techniques
Pro JavaScript Techniques is the ultimate JavaScript book for the modern web developer. It provides everything you need to know about modern JavaScript, and shows what JavaScript can do for your web sites. This book doesn't waste any time looking at things you already know, like basic syntax and structures.


Posted By

Juego on 07/19/08


Tagged

jquery mouse


Versions (?)


Who likes this?

2 people have marked this snippet as a favorite

rikaizm
rafael


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; });

You need to login to post a comment.