Skip to content

Instantly share code, notes, and snippets.

@ykob
Created March 17, 2016 21:50
Show Gist options
  • Save ykob/09cf9b41448e87d18f7f to your computer and use it in GitHub Desktop.
Save ykob/09cf9b41448e87d18f7f to your computer and use it in GitHub Desktop.
$('a[href^=#]').on('click', function() {
$('html,body').animate({
scrollTop: $($(this).attr('href')).offset().top
}, 1000);
return false;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment