title: How to detect scroll direction
body: <p>I want to run a function when someone scrolls down on an element. Something like this:</p>
  
  <pre><code> $('div').scrollDown(function(){ alert('down') });
   $('div').scrollUp(function(){ alert('up') });
  </code></pre>
  
  <p>But those functions don't exist. Is there a solution to this problem? <a href="http://awwwards.com" rel="noreferrer">Awwwards</a> seem to be able to do it (logo in navbar changes depending on scroll direction). Unfortunately, the source code is compressed, so no luck there.</p>