問題:除了滾動頂端動畫我「返回頂部」按鈕(右下拐角向下滾動之後)跳到右頂部。
<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