I’ve got this code:
$("#element").mousemove(function(e) {
if(e.pageX == 255) {alert("here");}
});
When I move fast with the mouse it doesn’t recognize the whole path it moves, it returns for example 260 and then 210 – not like I’d expect 260,259,258… Here comes the issue – I can’t get catch exact moment when I passed the position, because it doesn’t return this position. Is there any other way to get this position pixel after pixel? Thanks.
There is no way to get the browser to notify you of every pixel. The best you are going to do is every certain number of milliseconds (probably browser specific).
You can compensate for this by checking if you have crossed the position each time your function is called. It is not perfect, but it’s better:
http://jsfiddle.net/v4gTV/2/