问题:除了滚动顶端动画我“返回顶部”按钮(右下拐角向下滚动之后)跳到右顶部。
<a href="#top" id="homebacktothetop"><span>backtothetop</span></a>
我的JS(jQuery的):
// scroll to 0 when clicked
$('#homebacktothetop').click(function() {
$('body,html').animate({
scrollTop: 0
}, 800);
return false;
});
});
不知道。但是,如果您想阻止链接执行正常工作,click事件处理程序会使用'preventDefault'方法来代替'return false;'。 '.click(function(e){e.preventDefault();});' – musefan 2012-08-02 16:02:50