Skip to content

Instantly share code, notes, and snippets.

@yourtion
Created November 15, 2013 03:22
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 yourtion/7478569 to your computer and use it in GitHub Desktop.
Save yourtion/7478569 to your computer and use it in GitHub Desktop.
jQuery平滑滚动页面到某个锚点 From http://www.sharejs.com/codes/javascript/1089
$(document).ready(function() {
$("a.topMap").click(function() {
$("html, body").animate({
scrollTop: $($(this).attr("href")).offset().top + "px"
}, {
duration: 500,
easing: "swing"
});
return false;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment