Saturday, 15 December 2012

scrollto - jQuery scroll To Element


Here is jquery code

  
<script>
  function scrollToId(id) {
        $("html, body").animate({ scrollTop: $('#'+id).offset().top }, 1000);
    }
</script>


Here is HTML 


 
<ul class="menu">
  <li><a onclick="scrollToId('Div1')">Example of a Link</a></li>
  <li><a href="#Div2">The Active Link</a></li> 
</ul>

No comments:

Post a Comment