Created
November 2, 2015 16:31
-
-
Save DrewDouglass/e4a5c7c6723433c19b58 to your computer and use it in GitHub Desktop.
Smooth Scrolling for #links
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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