Friday, June 7, 2013

jQuery animated page scroll to anchor tag function

0
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
 },1000);
}
How to call scroll_to('.className'); or scroll_to('#id');
Source: http://snipplr.com/view/48385/

No comments :

Post a Comment