Skip to content

Instantly share code, notes, and snippets.

@DrewDouglass
Created November 2, 2015 16:31
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 DrewDouglass/e4a5c7c6723433c19b58 to your computer and use it in GitHub Desktop.
Save DrewDouglass/e4a5c7c6723433c19b58 to your computer and use it in GitHub Desktop.
Smooth Scrolling for #links
//Smooth scrolling for #links
var $root = $('html, body');
$('a').click(function() {
var href = $.attr(this, 'href');
$root.animate({
scrollTop: $(href).offset().top
}, 1000, function () {
window.location.hash = href;
});
return false;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment