<!DOCTYPE html>
<html lang="en">
<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">
<title>窗口滚动广告</title>
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
</head>
<style>
#item-container {
width: 150px;
height: 30px;
overflow: hidden;
}
.item {
width: 150px;
height: 30px;
background-color: blue;
}
</style>
<body>
<div id="item-container">
<div class="item">
<span>这是第一条新闻</span>
</div>
<div class="item">
<span>这是第二条新闻</span>
</div>
<div class="item">
<span>这是第三条新闻</span>
</div>
<div class="item">
<span>这是第四条新闻</span>
</div>
</div>
</body>
<script>
$(document).ready(function() {
setInterval(function() {
$('.item').last().hide().prependTo('#item-container').slideDown();
},1000)
})
</script>
</html>
jquery滚动新闻
猜你喜欢
转载自blog.csdn.net/weixin_45582052/article/details/103153536
今日推荐
周排行