mousemove coordinates and setTimeout
Here is the website it is about
http://nail.bezel.be/1/index.php?s=001
It's all about fading elements in and out. With the standard hover of jQuery it was not possible to NOT fade out an element if the mouse is over that element while reloading, so I programmed it differently and it got quite complicated. With standard jQuery hover the mouse has to exit the element first and then to reenter it again for the element to be faded back in. With my solution at least a slight movement of the mouse is enough to fade the element back in without having to leave and reenter the div. That is at least true with Firefox, I noticed that with other browsers the element is not faded out at all if the mouse is over that element while reloading even when the mouse is not moved at all.
The Firefox behavior is because it is not possible to get the mouse position without the mouse being moved.
There is one condition, though that does not work as expected. That is: If the mouse is not over an element while reloading, but is moved over it during the 2 seconds wait before fading out. I tried to solve that with setTimeout, but the thing is that the e.pageX and e.pageY values are the ones from the beginning of the setTimeout and not the ones that they have after 2 seconds, when the function is invoked. The (simplified) code for this would be:
$(document).mousemove(function(e){
setTimeout(function(){
$('#07').html(e.pageX +', '+ e.pageY);
}, 2000);
});
As I said: The e.pageX and e.pageY have the values of the moment the setTimeout function is invoked, not after the 2000 milliseconds have passed as they are supposed to be.
Any ideas?