title: jquery accordion scrolls to top on activate, then breaks on second click
body: <p>I am trying to create a jquery accordion which scrolls to the top of the link that is clicked. The following code achieves this, but breaks when the link is clicked for a second time:</p>
  
  <pre><code>$(function () {
      $("#paper-types").accordion({
          heightStyle: "content",
          collapsible: true,
          active: false,
          activate: function (event, ui) {
              var scrollTop = $(".accordion").scrollTop();
              var top = $(ui.newHeader).offset().top;
              $("html,body").animate({
                  scrollTop: scrollTop + top - 35
              }, "fast");
          }
  
     });
  });
  </code></pre>
  
  <p>This can be seen on a jsfiddle at:</p>
  
  <p><a href="http://jsfiddle.net/6PPEZ/1/" rel="nofollow">http://jsfiddle.net/6PPEZ/1/</a></p>
  
  <p>What is broken in this code that stops it working on the second click?</p>
  
  <p>EDIT: One thing that I have noticed is that it only stops working if you click the title to collapse the accordion. If you instead open the next link, the original link can be opened again without a problem.</p>