我有以下代码,它在CodePen、JSFiddle和我的浏览器中的行为有所不同。它只在CodePen中完美地工作。
本质上,我希望它不间断地从上到下无限滚动。
下面是这些代码的示例,http://jsfiddle.net/qmFD3/和http://codepen.io/anon/pen/fiaql
function scroller() {
$('#honor-roll ul').animate({
top: '-=' + $('#honor-roll ul li:last').height()
}, 1000, 'linear', function () {
var offset = $('#honor-roll ul li:last').offset().top;
console.log(offset);
if (offset <= 2000) {
$('#honor-roll ul').css("top", 0);
$('#honor-roll ul li:last').after($('#honor-roll ul li:first').detach());
}
});
}
$(document).ready(function () {
setInterval('scroller()', 200)
});发布于 2013-04-23 21:39:36
在jsFiddle中,控制台表示:
Uncaught ReferenceError: scroller is not defined
(anonymous function)https://stackoverflow.com/questions/16179599
复制相似问题