scrollTop jQuery 不工作:/
scrollTop jQuery not working :/
我在使用 scrollTop 函数时遇到问题。我尝试在单击 .scrollToComment 时将滚动设置为#comment,但不知道为什么它不起作用...
头:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js?ver=3.2.1"></script>
和滚动代码:
$(".scrollToComment").click(function() {
$('html, body').animate({
scrollTop: $("#comment").offset().top
}, 2000);
});
问题出在我开始的新小项目上:
http://katalogliquidow.mrqzi.webd.pl/
请帮忙。
替换滚动代码
<script>
$(document).on('click','.scrollToComment',function(){
$('html, body').animate({
scrollTop: $("#comment").offset().top
}, 2000);
});
</script>
对我来说很好用
干杯
我在使用 scrollTop 函数时遇到问题。我尝试在单击 .scrollToComment 时将滚动设置为#comment,但不知道为什么它不起作用...
头:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js?ver=3.2.1"></script>
和滚动代码:
$(".scrollToComment").click(function() {
$('html, body').animate({
scrollTop: $("#comment").offset().top
}, 2000);
});
问题出在我开始的新小项目上: http://katalogliquidow.mrqzi.webd.pl/
请帮忙。
替换滚动代码
<script>
$(document).on('click','.scrollToComment',function(){
$('html, body').animate({
scrollTop: $("#comment").offset().top
}, 2000);
});
</script>
对我来说很好用
干杯