title: Bootstrap navbar collapse on scroll
body: <p>I'm using bootstrap grayscale theme for my project and It has a navbar that collapses on scroll, or if I go to a link that's on the same page (#download etc.)</p>
  
  <p>The problem is when I go to anchor link from some other page, than navbar doesn't collapse until I scroll.</p>
  
  <p>I guess the solution is in adding the line in java script, but I really don't know what to add since I don't know java. :-(</p>
  
  <pre><code>// jQuery to collapse the navbar on scroll
  $(window).scroll(function() {
  if ($(".navbar").offset().top &gt; 50) {
      $(".navbar-fixed-top").addClass("top-nav-collapse");
  } else {
      $(".navbar-fixed-top").removeClass("top-nav-collapse");
  }
  });
  </code></pre>
  
  <p>Please, help. :) :-*</p>