jQuery: mousemove event - left, right within element
<p>I want to get mouse coords of a div, like this:</p>

<pre><code>$("#box").mousemove(function(e){
var x = e.pageX - this.offsetLeft;
var y = e.pageY - this.offsetTop;

document.getElementById("coords").innerHTML = x + ", " + y; });
</code></pre>

<p>But I also want to be able to tell if the cursor was moved to left or right; I know I just have to compare current mouse position with previous one, but I have no idea how to do it in this case. </p>

<p>Any help appreciated. Thank you</p>
