0
我從這個頁面中實現如下代碼:http://tympanus.net/codrops/2010/06/02/smooth-vertical-or-horizontal-page-scrolling-with-jquery/jQuery的滾動
$(document).ready(function() {
$('ul.navone li a, ul.navtwo li a,a.toplink, a.bodylink').bind('click',function(event){
var $anchor = $(this);
$('html, body, header').stop().animate({
scrollTop: $($anchor.attr('href')).offset().top
}, 1500,'easeInOutExpo');
event.preventDefault();
});
});
這一切都正常工作。
但是,在我的佈局中,我有一個固定的標題div(即它在用戶滾動時保持原位)。因此,我需要爲117像素的滾動腳本設置偏移量。
請問我該怎麼做?
優秀的,我其實需要的是-117,我改變.offset()頂部+ 117)至 - 117它的工作很好。非常感謝 –
嗯,這似乎有移動Safari瀏覽器的問題 – K2xL