当前位置: 移动技术网 > IT编程>开发语言>JavaScript > 基于jQuery实现的单行公告活动轮播效果

基于jQuery实现的单行公告活动轮播效果

2017年12月12日  | 移动技术网IT编程  | 我要评论
废话不多说了,直接给大家贴代码了,具体代码如下所示: <div class="lunbo123" style="position:relative;heig

废话不多说了,直接给大家贴代码了,具体代码如下所示:

<div class="lunbo123" style="position:relative;height: 45px;overflow: hidden;background-color:white" ;>
<ul id="myul" style="margin:6px;padding:0px;position:absolute;width: 700px; height: auto;">
<li>
<a href="" style=" rel="external nofollow" rel="external nofollow" text-decoration: none;color: #000000; ">
<span style="height:36px ; line-height: 36px;">公告test1 
</span>
</a>
</br>
</li>
<li>
<a href="" style=" rel="external nofollow" rel="external nofollow" text-decoration: none;color: #000000; ">
<span style="height:36px ; line-height: 36px;">活动test2 
</span>
</a>
</br>
</li>
</ul>
</div>
<script src="//cdn.bootcss.com/jquery/2.2.2/jquery.js"></script>
<script>
function lunbo123(id, height) {
var ul = $(id);
var lifirst = ul.find('li:first');
$(id).animate({
top: height
}).animate({
"top": 0
}, 0, function() {
var clone = lifirst.clone();
$(id).append(clone);
lifirst.remove();
})
}
setinterval("lunbo123('#myul','-45px')", 2500)
</script>
<style>
#myul {
list-style-type: none;
width: 300px;
height: 45px;
font-size: 20px;
}
</style>

总结

以上所述是小编给大家介绍的基于jquery实现的单行公告活动轮播效果,希望对大家有所帮助

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网