A-A+
	JQuery锚点链接平滑滚动效果
- $(function(){
 - $('a[href*=#],area[href*=#]').click(function() {
 - if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
 - var $target = $(this.hash);
 - $target = $target.length && $target || $('[name=' + this.hash.slice(1) + ']');
 - if ($target.length) {
 - var targetOffset = $target.offset().top;
 - $('html,body').animate({
 - scrollTop: targetOffset
 - },
 - 1000);
 - return false;
 - }
 - }
 - });
 - })
 
这段代码的好处是点击锚点链接平滑滚动到锚点,并且浏览器URL后缀不带有锚点字样,使用的过程中基本不用修改以上代码即可实现。

