title: Smooth scroll jumps back to top of page after processing
body: <p>I have a function using jquery with smooth scroll that scrolls from the top of the page to an anchor pulled from a URL hash.</p>
  
  <p>The scroll works fine, but when it completes, the page resets to the top. </p>
  
  <p>Here is how this is being implemented:</p>
  
  <pre><code> if (hash) { // if hash in the URL
  
      $('html, body')
        .animate({scrollTop:$(window.location.hash) 
          .offset().top - 200 }, 1000); 
    }
  </code></pre>
  
  <p>What could be causing this?</p>