title: Have navbar slide down at a specific point on a page?
body: <p>Hey everyone I've been learning js and HTML and I've been trying hard to learn alot.</p>
  
  <p>I have a navbar that I want to trigger at a certain part of my page (via scrolling). Right now the code I have forces the navbar to keep fading in and out in an endless loop.</p>
  
  <p>Here's my Javascript:</p>
  
  <pre><code>  $('.navbarclass').hide(0);
  
    $(window).on('scroll', function() {
          var y_scroll_pos = window.pageYOffset;
          var scroll_pos_test = 150;        
  
          if(y_scroll_pos &gt; scroll_pos_test) {
            $('.navbarclass').slideToggle();
          }
  
      });
  </code></pre>
  
  <p>Basically I want the navbar to trigger at 150 (which it does) but it keeps looping the toggle in and out.</p>