Skip to content

Instantly share code, notes, and snippets.

@bekapod
Created May 22, 2012 20:35
Show Gist options
  • Save bekapod/2771452 to your computer and use it in GitHub Desktop.
Save bekapod/2771452 to your computer and use it in GitHub Desktop.
JQUERY: AutoScroll to a section of your page
jQuery.fn.autoscroll = function(selector) {
$('html, body').animate(
{ scrollTop: $(selector).offset().top },
500
);
}
//Then to scroll to the class/area you wish to get to like this:
$('.area_name').autoscroll();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment