Created
July 18, 2014 21:30
-
-
Save megantaylor/261e4f6a76e844bbbe7a to your computer and use it in GitHub Desktop.
The following snippet will create a smooth sliding effect when a link with the topLink class is clicked.
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
$(document).ready(function() { | |
$("a.topLink").click(function() { | |
$("html, body").animate({ | |
scrollTop: $($(this).attr("href")).offset().top + "px" | |
}, { | |
duration: 500, | |
easing: "swing" | |
}); | |
return false; | |
}); | |
}); | |
//http://snipplr.com/view.php?codeview&id=26739 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment