This should be typically easy, I want to perform tracking of mouse movements. I'm capable of capturing the XY co-ords.
However, as far as I'm aware, this will vary according to the browser size, right ?
If so, can anyone recommend other things to track to ensure my results are accurate?
P.s I'm using 开发者_如何学Cthe following Jquery example
$("html").mousemove(function(e){
var pageCoords = "( " + e.pageX + ", " + e.pageY + " )";
var clientCoords = "( " + e.clientX + ", " + e.clientY + " )";
$("span:first").text("( e.pageX, e.pageY ) - " + pageCoords);
$("span:last").text("( e.clientX, e.clientY ) - " + clientCoords);
});
Coordinates are independent of the browser size.
Hope this helps. Cheers
PS: Use $(window).mousemove
or $(document).mousemove
instead of $("html").mousemove
, it's a better practice.
精彩评论