Skip to content

Instantly share code, notes, and snippets.

@VincentLoy
Created June 5, 2015 16:44
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 VincentLoy/997719f71a6eef6bec5a to your computer and use it in GitHub Desktop.
Save VincentLoy/997719f71a6eef6bec5a to your computer and use it in GitHub Desktop.
scrollTo jQuery
$element.click(function (e) {
e.preventDefault();
var page,
speed;
page = $(this).attr('href');
speed = 750;
$('html, body').animate({
scrollTop: $(page).offset().top
}, speed);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment