Hi Alexander,

This one is really tricky in plain JavaScript because of all the different browser implementations, but fortunately jQuery smoothes out the inconsistencies.

Just add the "event" arg inside a mouse event handler's anon. function and then refer to the coordinates as event.pageX and event.pageY.

For example, if you're testing this in Firefox with Firebug, you can do this to see the mouse position in the console:

.mousemove(function(event) {
console.log('Mousemove event was triggered. event.pageX is ' + event.pageX + '. event.pageY is ' + event.pageY + '.');

Hope that helps get you started.

--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On May 27, 2007, at 7:08 AM, Alexander Petri wrote:

Hi i have to build a custom tooltip

how can i get the current x and y mouseposition?

Reply via email to