草庐IT

lastSeenAt

全部标签

javascript - 如何检测用户鼠标移动的距离?

我正在尝试检测鼠标移动的距离(以像素为单位)。我目前正在使用:$(document).mousemove(function(event){varstartingTop=10,startingLeft=22,math=Math.abs(((startingTop-event.clientY)+(startingLeft-event.clientX))+14)+'px';$('span').text('Fromyourstartingpoint(22x10)youmoved:'+math);});但是,我觉得这不是正确的方法,是吗?这对我来说并不一致。这是它现在如何工作的演示:http:/