仿天猫原创频道-品牌发展时间表-动画效果


 

<!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=gb2312" />
<script src="jquery-1.8.3.js"></script>
<title>无标题文档</title>
<style>
*{
  margin:0;
  padding:0;
}
ul{
  list-style:none;
}
#outDiv{
  width:435px;
  height:85px;
  position:relative;
  margin-top:20px;
  margin-left:20px;
  border:1px solid #000;
}
.up_content{
  position:absolute;
  width:135px;
  height:60px;
}
.up_content p{
  width:133px;
  height:38px;
  background-color:#999;
  position:absolute;
  opacity:0;
  filter:alpha(opacity=0);
  padding-left:2px;
  padding-top:2px;
  color:#fff;
}
.up_content b{
  position:absolute;
  border-width:10px;    
  border-style:solid dashed dashed dashed;  //实现三角形效果
  border-color:#999 transparent transparent transparent; //实现三角形效果
  left:57px;
  width:0;
  bottom:0;
  opacity:0;
  filter:alpha(opacity=0);
}
#outDiv .active p, #outDiv .active b{
  opacity:1;
  filter:alpha(opacity=100);
}
.years{
  position:absolute;
  background:url(T1Gy2TXf0eXXalw5Hh-990-209.png) -125px -86px no-repeat;
  background-color:#666;
  width:433px;
  height:35px;
  top:50px;
}
.years li{
  background-image:url(T1Gy2TXf0eXXalw5Hh-990-209.png);
  background-color:#ddd;
  background-repeat:no-repeat;
  width:45px;
  height:35px;
  position:absolute;
  border-left:2px dashed #fff;
  border-right:2px dashed #fff;
  filter:alpha(opacity=0);
  opacity:0;
}
.years .year1{
  left:43px;
  background-position:-170px -122px;
}
.years .year2{
  left:118px;
  background-position:-244px -122px;
}
.years .year3{
  left:192px;
  background-position:-320px -122px;
}
.years .year4{
  left:267px;
  background-position:-394px -122px;
}
.years .year5{
  left:342px;
  background-position:-470px -122px;
}
.years .liActive{
  filter:alpha(opacity=100);
  opacity:1;
}
</style>
</head>

<body>
<div id="outDiv">
   <div class="up_content active">
      <p>文字文字2007</p>
   <b></b>
   </div>
   <div class="up_content" style="left:75px;">
      <p>文字文字2008</p>
   <b></b>
   </div>
   <div class="up_content" style="left:150px;">
      <p>文字文字2009</p>
   <b></b>
   </div>
   <div class="up_content" style="left:225px;">
      <p>文字文字2010</p>
   <b></b>
   </div>
   <div class="up_content" style="left:300px;">
      <p>文字文字2011</p>
   <b></b>
   </div>
   <ul class="years">
      <li class="year1 liActive"></li>
   <li class="year2"></li>
   <li class="year3"></li>
   <li class="year4"></li>
   <li class="year5"></li>
   </ul>
</div>
<script>

/*

* 仿天猫原创频道-品牌发展时间表-动画效果

* 通过setTimeout实现轮动;

* ie8.ff.opera中测试可用,其他浏览器未测

* *****madeby keimon*******

* ******2013-01-10*********

*/
var timer;
var len = $('.up_content').length;
var i =0;
function t(i){
  if(i==5){
    i=0;
  }
  $('.up_content').removeClass('active');
  $('ul.years li').removeClass('liActive');
  $('.up_content').eq(i).addClass('active');
  $('ul.years li').eq(i).addClass('liActive');
  timer = setTimeout(function(){t(i)}, 2000);
  i++;
}
t(i);

//当鼠标经过li标签时,取消计时器,当鼠标离开时,重新开启计时器

$('ul.years li').hover(function(){
   clearTimeout(timer);
   $('.up_content').removeClass('active');
   $('ul.years li').removeClass('liActive');
   var liHover = this;
   i = $('ul.years li').index(liHover);
   $('.up_content').eq(i).addClass('active');
   $('ul.years li').eq(i).addClass('liActive');
},function(){
   timer = setTimeout(function(){t(i)}, 2000);
})
</script>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值