title: How to make page scroll to top when click the vertical tab
body: <p>my demo link: <a href="http://www.bajistech.info/tiltindicators.html#TiltWatch-Plus1" rel="nofollow">http://www.bajistech.info/tiltindicators.html#TiltWatch-Plus1</a>, i'm trying to make page scroll when i'm click on the vertical tab. </p>
  
  <p>//script 1
       $(document).ready(function(){</p>
  
  <pre><code>    if (
          $('ul#verticalNav li a').length &amp;&amp;
          $('div.section').length
      ) {
          $('div.section').css( 'display', 'none' );
          //$('ul#verticalNav li a').each(function() {
          $('ul#verticalNav li a').click(function() { 
              showSection( $(this).attr('href') );
          });
    // if hash found then load the tab from Hash id
          if(window.location.hash) 
          {
     // to get the div id
             showSection( window.location.hash);
          }
          else // if no hash found then default first tab is opened
          {
              $('ul#verticalNav li:first-child a').click();
          }
      }
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>//script 2</p>
  
  <pre><code>function showSection( sectionID ) {
      $('div.section').css( 'display', 'none' );
      $('div'+sectionID).css( 'display', 'block' );
  }
  $(document).ready(function(){
  
      if (
          $('ul#verticalNav li a').length &amp;&amp;
          $('div.section').length
      ) {
          $('div.section').css( 'display', 'none' );
          //$('ul#verticalNav li a').each(function() { // no need for each loop
          $('ul#verticalNav li a').click(function() { // Use $('ul#verticalNav li a').click
              showSection( $(this).attr('href') );
          });
          //});
          if(window.location.hash) // if hash found then load the tab from Hash id
          {
             showSection( window.location.hash);// to get the div id
          }
          else // if no hash found then default first tab is opened
          {
              $('ul#verticalNav li:first-child a').click();
          }
      }
  });
  </code></pre>
  
  <p>html sourcce code</p>
  
  <pre><code> &lt;ul&gt;
      &lt;li&gt;&lt;a href="#a"&gt;a&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#b"&gt;b&lt;/a&gt;&lt;/li&gt;          
      &lt;/ul&gt;
      &lt;div id="sections"&gt;
      &lt;div class="section" id="a"&gt;
      &lt;/div&gt;
      &lt;div class="section" id="b"&gt;
      &lt;/div&gt;
  </code></pre>