1
我有這個jQuery函數,我希望它滾動到possition -60px,因爲我有一個固定的導航欄,它與內容重疊。我如何添加這60px到這個代碼?jquery滾動到錨點-60px
/**
* Scroll to section
* @param string des HTML identity of section block
* @return void
*/
function goToSectionID(des){
var os = (history.pushState)?51:0;
os = (jQuery(window).width()>800)?os:0;
var pos = (jQuery(des).length>0)?jQuery(des).offset().top-os:0;
onanimate = true;
jQuery('html,body').animate({scrollTop:pos},1000,function(){
if(history.pushState){
history.pushState(null,null,des);
}else window.location.hash = des;
jQuery(window).scrollTop(pos);
onanimate=false
});
}
'的jQuery(窗口).scrollTop(POS - 60);'? –