Skip to content

Instantly share code, notes, and snippets.

@megantaylor
Created July 18, 2014 21:30
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 megantaylor/261e4f6a76e844bbbe7a to your computer and use it in GitHub Desktop.
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.
$(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