仿sina新浪微博新鲜事滚动特效的JS代码

5 篇文章 0 订阅

用JQuery 仿sina新浪微博新鲜事滚动特效的JS代码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/jscript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/jscript">
$(document).ready(function(e) {
 var in_out_time = 800 //渐显时间
 var scroll_Interval_time = 2000 //滚动间隔时间
 var scroll_time = 1000 //滚动动画时间
   
 addli() 
 
 function addli(){
  $("#scroll_List").css("top",0);
  $("#scroll_List li:last").clone().prependTo("#scroll_List");
  $("#scroll_List li:first").css("opacity",0);
  $("#scroll_List li:first").animate({opacity:1},in_out_time);
  setTimeout(delLi_last,scroll_Interval_time) 
 }
 
 function delLi_last(){
  $("#scroll_List li:last").detach(); 
  $("#scroll_List").animate({top:100},scroll_time,addli)
 }
 
});
</script>
<style>
*{
 margin:0px;
 padding:0px;
 list-style:none;
}

.centerBox{
 left:50%;
 width:162px;
 margin-left:-151px;
 top:10%;
 height:502px;
 margin-top:0px;
 position:absolute;
}

.main{
 width:160px;
 height:500px;
 float:left;
 border:1px solid #ccc;
}

.main strong{
 width:150px;
 height:495px;
 float:left;
 overflow:hidden;
 margin:5px 5px 0px 5px;
 display:inline;
 position:relative;
}

.main strong ul{
 width:150px;
 position:absolute;
}

.main strong ul li{
 width:150px;
 height:160px;
 line-height:100px;
 text-align:center;
 color:#FFF;
 font-family:"simhei";
 font-size:20px;
 margin-bottom:5px;
}

.main strong ul li img{ border:0px;}

.main strong ul .li_1{
 background:#900;
}

.main strong ul .li_2{
 background:#9C0;
}

.main strong ul .li_3{
 background:#036;
}

.main strong ul .li_4{
 background:#C60;
}

.main strong ul .li_5{
 background:#636;
}

.main strong ul .li_6{
 background:#999;
}

</style>
</head>

<body>
 <div class="centerBox">
  <div class="main">
   <strong>
    <ul id="scroll_List">
     <li class="li_1"><a href="http://www.chaonanwo.com/note/131/g/103" target="_blank"><img src="http://www.chaonanwo.com/public/upload/share/000/000/001/31/8ba706159850b27253b41814f856de85nHK4hH_150x160.jpg" width="150" height="160" /></a></li>
     <li class="li_2"><a href="http://www.chaonanwo.com/note/126/g/98" target="_blank"><img src="http://www.chaonanwo.com/public/upload/share/000/000/001/26/b429231ef938665bde49ece84a6ed7ccwXXX4q_150x160.jpg" width="150" height="160" /></a></li>
     <li class="li_3"><a href="http://www.chaonanwo.com/note/100/g/72" target="_blank"><img src="http://www.chaonanwo.com/public/upload/share/000/000/001/00/ba3fc00bf803392c3ee75f148190dc28TmPzpD_150x160.jpg" width="150" height="160" /></a></li>
     <li class="li_4"><a href="http://www.chaonanwo.com/note/25/g/18" target="_blank"><img src="http://www.chaonanwo.com/public/upload/share/000/000/000/25/baeaea83b04207e353aa58fa08f0d1b2Puvp3e_150x160.jpg" width="150" height="160" /></a></li>
    </ul>
   </strong>
  </div>
 </div>
</body>
</html>


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值