title: Bootstrap accordion scroll to top of active panel heading
body: <p>I'm looking for a code that scrolls up to the top of the currently active panel heading of my bootstrap 3 html/css accordion. The closest solution I've found on stackoverflow is the snippet of js below. </p>
  
  <p>This snippet works fairly well, but when a panel heading gets clicked the page scrolls such that the very top of the panel content is flush with the top of the screen. Is there a way to modify this so that the scrolling effect will result in the panel "heading" (as opposed to the top of panel content area) being visible at the top of the screen?</p>
  
  <pre><code>    $(function () {
      $('#accordion').on('shown.bs.collapse', function (e) {
      var offset = $('.panel.panel-default &gt; .panel-collapse.in').offset();
      if(offset)$('html,body').scrollTop(offset.top); }); });
  </code></pre>
  
  <p>Let me know if I should be sharing the bootstrap accordion html as well.</p>