title: Hide or show menu bar on scrolling
body: <p>I got to animate a div when <code>$('body').scrollTop() &gt; 45</code></p>
  
  <p>I need animate the same div when the user scrolls up. I tried this code, the first <strong>if</strong> works. How can I get the second <strong>conditional</strong> to work?</p>
  
  <pre><code>    if ($('body').scrollTop() &gt; 45) {
  
          $('.my-div').animate({
              top:'-45px'
          }, 200);
      }         
      if (¿?user-scrolls-up¿?) {
  
          $('.my-div').animate({
              top:'0px'
          }, 200);
      } 
  </code></pre>