Created
June 12, 2012 21:55
-
-
Save pitch-gist/2920368 to your computer and use it in GitHub Desktop.
JavaScript: jQuery Animate Anchor Scroll
This file contains hidden or 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 anchor | |
// add a class of scroll to any anchor link and this will smoothly scroll to the location. | |
$(".scroll").click(function(e){ | |
e.preventDefault(); | |
$('html,body').animate({scrollTop:$(this.hash).offset().top}, 500); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment