title: Animate scrollTop with offset
body: <p>I am using jQuery UI accordion but some of the text is too long which causes it to be neaer the top of the page. What i wanted was when a section was opened it would jump to the top of the section. This code works perfectly in doing that but it snaps to the top, which looks clitchy. </p>
  
  <pre><code>$('#accordion').bind('click',function(){
  theOffset = $(this).offset();
  $(window).scrollTop(theOffset.top - 50);
  });
  </code></pre>
  
  <p>How would i animate the scrollTop so it "glides" to the top</p>
  
  <p>Many thanks</p>