2010-04-12 67 views
0

我想要在单个网页上获得光标的偏移量或位置。假设我将鼠标移动到屏幕中间,然后我想知道偏移量。例如光标偏移与jQuery(不脱字)

左:603像素 顶:521像素

从坐标页面0,0。

所以问题是,是否有可能获得与jQuery的光标坐标?

回答

0

看来我可以使用jQuery中可用的事件,例如;

$(document).ready(function(){ 

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

}); 

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

还是谢谢!