0
我想打一個頁面的網站,一個div(導航)與固定位置和z指數999jQuery的滾動,不能得到緩解工作
的目標是使頂部的DIV和住宿所有其他內容滾動。 我得到了這個工作正常,但我想使它更「順利」與緩和,但我嘗試使腳本停止工作。這是工作腳本:
$(document).ready(function(){
$('a[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;
}
}
});
});`
任何人都可以幫我使用緩動部分嗎?我希望滾動在靠近錨點時快速啓動並放慢速度。
在此先感謝。
建議您編輯您的帖子以格式化Javascript代碼,顯示正常的縮進。你有什麼是真的很難閱讀。 – 2011-04-04 12:08:09
對不起。完成:) – Luuk 2011-04-04 12:27:30