//该方法需将ul设置为相对定位,top值为0
funciton scroll(){
//获取滚动的距离
var top = 30;
//使用定时器实在一直滚动
setInterval(function(){
$(’.ul’).animate({
‘top’:-top
},1000,function(){
//第一个元素滚动完以后将第一个元素添加到ul最后去
(′.ul>li:first−child′).appendTo(′('.ul>li:first-child').appendTo('(′.ul>li:first−child′).appendTo(′(’.ul’)’);
$(’.ul’).css(‘top’,0);
})
})
}
// 完整代码
- 111
- 222
- 333
- 444