title: detect mouse direction
body: <p>I am trying this code to detect if the mouse direction is going up or  down:</p>
  
  <pre><code>&lt;html&gt;  
      &lt;head&gt;&lt;/head&gt;
      &lt;body&gt;
          &lt;div style="width: 500px; height: 500px; background: red;"&gt;&lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <hr>
  
  <pre><code>var mY = 0;
  $('body').mousemove(function(e) {
      mY = e.pageY;
      if (e.pageY &lt; mY) {
          console.log('From Bottom');
          return;
  
      } else {
          console.log('From Top');
      }
  
  });
  </code></pre>
  
  <p></p>
  
  <p>However this code doesn't work was i expect. Console log always show "from top"</p>
  
  <p>Any idea ?</p>
  
  <p><a href="http://jsfiddle.net/Tm2uV/" rel="nofollow">demo</a></p>