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);'? –