Don't like ads? PRO users don't see any ads ;-)

smooth scroll to html element

By: giammin on Jul 26th, 2012  |  syntax: JavaScript  |  size: 0.18 KB  |  hits: 35  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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>