giammin

smooth scroll to html element

Jul 26th, 2012
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function goToByScroll(id){
  2.     $('html,body').animate({scrollTop: $("#"+id).offset().top},'slow');
  3. }  
  4.  
  5. <a href="javascript:void(0)" onClick="goToByScroll('1')">Go to anchor 1</a>
Advertisement
Add Comment
Please, Sign In to add comment