Donec sed odio dui。 Nullam id dolor id nibh ultricies vehicula ut id elit。 Morbi leo risus,porta ac consectetur ac,vestibulum at eros。 Cras justo odio,dapibus ac facilisis in,egestas eget quam。
答案 0 :(得分:0)
滚动不在主体或html标签上,它在包装器上......
更改代码如下:
$("a.scroll").click(function(event){
event.preventDefault();
$('.wrapper').animate({
scrollTop:$(this.hash).offset().top - $('#header').outerHeight()
}, 550);
})
答案 1 :(得分:0)
$("a.scroll").click(function(event){
event.preventDefault();
$('.wrapper').animate({
scrollTop:$(this.hash).offset().top - $('').outerHeight()
}, 550);
})
我刚刚添加了一个<a id="Page1"></a>
锚到我不知道的地方然后代码滚动到$('body').animate
而不是$('.wrapper')
的位置,因为我的卷轴在正文中,此代码已经过测试在2016年6月2日,它使用Chrome和Fire fox [JQuery Loaded] 100%工作。