用jquery動畫做一個向上翻動的廣告效果

在這裏插入圖片描述

<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
	<title></title>
	<style>
		.container{
			height: 40px;
			background-image: linear-gradient(#e66465, #9198e5);
		}
		.move{
			height: 200px;
			list-style: none;
			position: relative;
		}
		.move a{
			text-decoration: none;
			color: white;
		}
		.move li{
			height: 40px;
			width: 100%;
			line-height: 40px;
			text-align: center;
		}
	</style>
</head>
<body>
	<div class="container">
		<ul class="move">
			<li><a href="#">京東618</a></li>
			<li><a href="#">淘寶雙11</a></li>
			<li><a href="#">騰訊英雄聯盟</a></li>
			<li><a href="#">騰訊穿越火線</a></li>
			<li><a href="#">光宇問道</a></li>
		</ul>
	</div>
	<script>
		window.setInterval(function(){
			$('.move').animate({top:'-40px'},'slow',function(){
				$('.move').css('top',0);
				$('.move li:last').after($('.move li:first'));
			});
		},2000);
	</script>
</body>
</html>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章