Created
February 18, 2013 03:40
-
-
Save libo1106/4974975 to your computer and use it in GitHub Desktop.
锚点平滑滚动
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
$('a').click(function(){ | |
var href = $(this).attr("href"); | |
var pos = $(href).offset().top; | |
$("html,body").animate({scrollTop: pos}, 1000); | |
return false; | |
}); | |
// 参考网址 | |
// http://www.zhangxinxu.com/wordpress/2010/07/锚点跳转及jquery下相关操作与插件/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment