我使用下面的代码滚动到一个div,它滚动到这个div,然后滚动回到页面顶部,为什么?
$("#Qtags").click(function(){
$('html, body').animate({'scrollTop' : $($(this).attr('href')).offset().top},1000)
return false;
});
我已经准备好了 dom 函数
最佳答案
看看这个:-
$('html,body').animate({ scrollTop: $(this.hash).offset().top }, 500);
关于javascript - 如何在页面加载时滚动到某个 Div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20629869/