【发布时间】:2014-10-02 08:44:27
【问题描述】:
我试图让我的页面上的特定 div 自动开始向下滚动,然后在页面加载后备份。
这是为我的 javascript 编写的:
<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。
感谢您的帮助!
【问题讨论】:
标签: javascript jquery scroll vertical-scrolling