我试图准确记录鼠标在网页上的移动位置(移动到像素)。我有以下代码,但结果数据中存在差距。
var mouse = new Array();
$("html").mousemove(function(e){
mouse.push(e.pageX + "," + e.pageY);
});但是,当我查看记录的数据时,这是我所看到的一个例子。
76,2 //start x,y
78,5 //moved right two pixels, down three pixels
78,8 //moved down three pixels这最好看起来更像:
76,2 //start x,y
77,3 //missing
78,4 //missing
78,5 //moved right two pixels, down three pixels
78,6 //missing
78,7 //missing
78,8 //moved down three pixels有没有更好的方法来逐个像素地存储鼠标移动数据?我的目标对于一个网页来说是不是太不现实了?
发布于 2011-10-13 12:59:58
有没有更好的方法来逐个像素地存储鼠标移动数据?
你对“更好”的标准是什么?
我的目标对于一个网页来说是不是太不现实了?
如果你的目标是在每次光标进入一个新的像素时存储一个新的点,是的。还要注意的是,浏览器像素不一定1:1映射到屏幕像素,特别是在CRT显示器的情况下,它们几乎肯定不会。
https://stackoverflow.com/questions/7749538
复制相似问题