jq实现无缝向上滚动
- js/Jquery
- 时间:2019-01-23
- 5330人已阅读
简介
效果图:
关键代码:
<script>
function lunbo(id, height) {
var ul = $(id);
var liFirst = ul.children(".item:lt(4)");
$(id).animate({top: height}).animate({"top": 0}, 0, function () {
var clone = liFirst.clone();
$(id).append(clone);
liFirst.remove();
})
}
setInterval("lunbo('.bbb','-80px')", 2000);
</script>
/*
无缝向上滚动
调用方法:setInterval("lunbo('.lunbo_ul','-50px')", 2000)
.lunbo_ul:要滚动盒子的class
-50px:一次滚动的高度
2000:周期
*/
(2)