Skip to content

Instantly share code, notes, and snippets.

@EdwardIII
Created May 14, 2013 10:10
Show Gist options
  • Save EdwardIII/5574966 to your computer and use it in GitHub Desktop.
Save EdwardIII/5574966 to your computer and use it in GitHub Desktop.
var $root = $('html, body');
$('a.smoothscroll').click(function() {
var href = $.attr(this, 'href');
$root.animate({
scrollTop: $(href).offset().top
}, 500, 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