Skip to content

Instantly share code, notes, and snippets.

@handerson
Created June 14, 2010 14:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save handerson/437772 to your computer and use it in GitHub Desktop.
Save handerson/437772 to your computer and use it in GitHub Desktop.
jQuery plugin for a simple scroll to animation
// scroll to animation
// example usage: $('.scroll_to_here').scrollTo();
jQuery.fn.scrollTo = function(speed) {
if(speed === undefined ){
speed = 'slow';
}
$('html,body').animate({scrollTop: this.offset().top},speed);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment