title: On page refresh avoid re-running a Jquery slide down/up function.
body: <p>I have made a simple Jquery slide down/up function that triggers when scroll is above and under 40. That seems to work decent, but if I refresh the page when i scrolled to bottom at page etc the script re-runs the animation and sometimes it just show as initial state, and I have to scroll again to hide the top header division. </p>
  
  <p>Is there an option to avoid this? Some kind of "if the scroll interaction is over 40 it wont trigger.</p>
  
  <p>Tips / help much appreciated. </p>
  
  <pre><code>&lt;script&gt;
      $(window).scroll(function(){
          if($(window).scrollTop() &gt; 40){
              $(".header-top").slideUp();
          }
          if($(window).scrollTop() &lt; 40) {
              $(".header-top").slideDown();
          }
      });
  &lt;/script&gt;
  </code></pre>