Friday, June 7, 2013

jQuery animated page scroll to anchor tag function

This function allows you to pass any div anchor tag as a parameter to scroll to. You can easily add easing after the 'duration' parameter in the jQuery animation function.

function scroll_to(div){
 $('html, body').animate({
  scrollTop: $(div).offset().top
How to call scroll_to('.className'); or scroll_to('#id');

No comments :

Post a Comment