关键代码段
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
*{
margin:0;
padding:0;
}
.lunbo{
position: relative;
width: 400px;
height: 60px;
/*border:1px solid greenyellow;*/
overflow: hidden;
margin:0 auto;
}
ul{
position:absolute;
left: 50px;
top:0;
width: 300px;
height: auto;
list-style: none;
}
ul li{
width: 300px;
height: 30px;
line-height: 30px;
font-size:20px;
color:#333;
text-align: center;
list-style: none;
}
</style>
</head>
<body>
<div class="lunbo">
<ul class="change">
<li>人生在世须尽欢,莫使金樽空对月</li>
<li>我寄愁心与明月,随风直到夜郎西</li>
<li>不是花中偏爱菊,此花开尽更无花</li>
<li>辛苦遭逢起一经,干戈寥落四周星</li>
<li>山河破碎风飘絮,身世浮沉雨打萍</li>
<li>惶恐滩头说惶恐,零丁洋里叹零丁</li>
<li>人生自古谁无死?留取丹心照汗青</li>
</ul>
</div>
<!--<script src="//cdn.bootcss.com/jquery/2.2.2/jquery.js"></script>-->
<script type="text/javascript" src="jquery-2.1.4.js">
</script>
<script>
function lunbo(height){
var liFirst=$(".change").find('li:first');
var liTwo=$(".change").find('li:nth-child(2)');
$(".change").animate({top:height}).animate({"top":0},0,function(){
var clone=liFirst.clone();
var clone2=liTwo.clone();
$(".change").append(clone);
$(".change").append(clone2);
liFirst.remove();
liTwo.remove();
})
}
setInterval("lunbo('-60px')",3000)
</script>
</body>
</html>