title: Detecting Mouse Movement Without JQuery
body: <p>I'm looking for a small piece of javascript that will check for mouse movement and in the event it does execute a function. I'm looking to do this <strong>without jquery</strong> and preferably compatible with most modern browsers. I have this small script which detects when the mouse isn't moving:</p>
  
  <pre><code>&lt;script&gt;
  document.onmousemove = (function() {
    var onmousestop = function() {
      /* do stuff */
    }, thread;
  
    return function() {
      clearTimeout(thread);
      thread = setTimeout(onmousestop, 500);
    };
  })();
  &lt;/script&gt;
  </code></pre>
  
  <p>I'm hoping things can be edited into firing the do stuff when the mouse is moved for the first time after loading the script? Any help? Thanks</p>