title: Smooth Scrolling jumps weirdly
body: <pre><code>$(function() {$('a[href*=#]:not([href=#])').click(function() {
  if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') &amp;&amp; location.hostname == this.hostname) {
    var target = $(this.hash);
    target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
    if (target.length) {
      $('html,body').animate({
        scrollTop: target.offset().top
      }, 1000);
      if (target.length &lt;= 1000) {
        $('html,body').animate({
          scrollTop: target.offset().top - 60
        }, 1000);
      };
      return false;
    }
  }});});
  </code></pre>
  
  <p>I’m working with a nav bar that becomes fixed with a screen max-width &lt; 1000px.<br> The height of the navigation bar is 60px. So it goes backwards with animation 60px if max-with &lt; 1000px.<br></p>
  
  <p>All this works fine, but my problem is that the page jumps weirdly only when the viewport is bigger than 1000px.</p>