Javascript 自动向下滚动页面
我试图在我的页面上获得一个特定的div,以便自动开始向下滚动,然后在页面加载后进行备份 我已经为我的javascript编写了以下内容:Javascript 自动向下滚动页面,javascript,jquery,scroll,vertical-scrolling,Javascript,Jquery,Scroll,Vertical Scrolling,我试图在我的页面上获得一个特定的div,以便自动开始向下滚动,然后在页面加载后进行备份 我已经为我的javascript编写了以下内容: <script> function scroll(speed) { $('#scrollingcontent').animate({ scrollTop: $(document).height() - $(window).height() }, speed, function() { $(this).animate({ scrollTop:
<script> function scroll(speed) {
$('#scrollingcontent').animate({ scrollTop: $(document).height() - $(window).height() }, speed, function() {
$(this).animate({ scrollTop: 0 }, speed);
});
}
speed = 1000;
scroll(speed)
setInterval(function(){scroll(speed)}, speed * 2);</script>
Chrome告诉我,我有一个引用错误,并且没有定义$。
我想要设置动画的div的id为scrollingcontent
谢谢你的帮助 检查是否正确附加了jQuery
<head>
<script src="jquery-1.11.1.min.js"></script>
</head>
更多:-
希望这有帮助。干杯 我遗漏了那一行,但当我刷新页面时,它仍然没有滚动。您是否真的有名为“scrollingcontent”的div?如果你检查一下浏览器会说什么?有错误吗?是的,需要滚动的div在这里: