title: scrollTop offset for nav hide on scroll down
body: <p>I'm using a script for hiding the nav when scrolling down and showing it again when scrolling up. But on iOS the menu disappears because there is a 'bounce' when you hit the top of the page. I was thinking that an offset for triggering the script on the top of the page could fix this, or is there an other way?</p>
  <pre><code>var prev = 0;
  var $window = $(window);
  var nav = $('#top-bar-container');
  
  $window.on('scroll', function(){
    var scrollTop = $window.scrollTop();
    nav.toggleClass('hidden', scrollTop &gt; prev);
    prev = scrollTop;
  });
  </code></pre>
  <pre><code>.hidden {
    transform: translateY(-100%);
    transition-duration: 0.6s !important;
    transition-timing-function: ease-in-out;
  }
  </code></pre>