tags:

views:

119

answers:

1

Hi, I'm trying to get the offset or position of the cursor on a single web page. Let's say I move the mouse to the middle of the screen, I then want to know the offset. For example

left: 603 px top: 521 px

from the coordinate 0,0 of the page.

So the question is, is it possible to get the cursor coordinates with jquery?

A: 

It seems I can use the event that avaiable in jQuery, for example;

$(document).ready(function(){

     $("body").live("click", get_coords);

});

function get_coords(event){
    console.log(event.clientX);
        console.log(event.clientY);
}

Thanks anyway!

Stefan Konno