JS打造的一个页面多次调用的图片幻灯切换效果丨芯晴网页特效丨CsrCode.Cn

<!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>
<title>JS打造的一个页面多次调用的图片幻灯切换效果丨芯晴网页特效丨CsrCode.Cn</title>
<meta http-equiv= " content-type " content= " text/html;charset=gb2312 ">
<!--把下面代码加到<head>与</head>之间-->
<script language= " javascript ">
var $o =  new Object();
$o. base = {
 e:function(a,f){
   for( var i= 0,j=a.length;i<j;i++){f.call(a[i],i);}
 }
}
$o. slide = function (id,arg){
  var arg = arg||{},
 t = document.getElementById(id),
 a = t.getElementsByTagName( " a "),
 lis = [],
 cl = arg.color|| ' #f30 ',
 ctm = arg.time* 1000|| 2000,
 w = t.clientWidth,
 h = t.clientHeight,
 b = [ ' <ul style="margin:0;padding:0;list-style:none;display:block;position:absolute;bottom:10px;right:10px;"> '],
 index =  0,
 $ =  null,
 $ =  null;
 function change(i){
   if(!!$){clearTimeout($);}
  index = !isNaN(i)?i:index+ 1;
   if(index >= a.length){index =  0;}
  $o. base.e(lis,function(k){ if(k == index){c( 1, this);} else{c( 0, this)}});
   var to = - index*h;
   if(a[ 0].offsetTop == to){
    return;
  } else{
    if(!!$){clearInterval($);}
   $ = setInterval(function(){
     var ot = a[ 0].offsetTop;
    v = Math[to<ot? ' floor ': ' ceil ']((to - ot)* 0.2);
     if(ot == to){clearInterval($);$= null;st();}
    ot += v;
    a[ 0].style.marginTop = ot +  " px ";
   }, 30)
  };
 }
 function c(b,o){
  o.style.backgroundColor = !!b?cl: " #fff ";
  o.style.color = !!b? " #fff ":cl;
 }
 function st(){
   if(!!$)clearTimeout($);
  $ = setTimeout(function(){change()},ctm);
 }
 with(t.style){overflow =  ' hidden ';position =  ' relative ';}
 $o. base.e(a,function(n){
   this.style.display =  " block ";
  with( this.firstChild.style){borderWidth =  ' 0 ';width = w +  ' px ';height = h +  ' px ';}
  b.push( ' <li style="width:20px;height:20px;line-height:20px;display:block;float:left;margin-left:5px;border:1px solid  ' + cl +  ' ; background-color:#fff;color: ' + cl + ' ;font-size:14px;text-align:center;cursor:pointer;"> ' + (n+ 1) +  ' </li> ');
 });
 b.push( ' </ul> ');
 t.innerHTML += b.join( "");
 lis = t.getElementsByTagName( " li ");
 $o. base.e(lis,function(n){
   if(n == index){c( 1, this)}
   this.onmouseover = function(){
    if(n!=index)change(n);
  }
 });
 st();
}
</script>
</head>
<body>
<!--把下面代码加到<body>与</body>之间-->
<div id= " aa " style= " width:502px;height:258px; ">
 <a href= " javascript:alert('1') "><img src= " http://www.CsrCode.cn/images/m01.jpg "></a>
 <a href= " javascript:alert('2') "><img src= " http://www.CsrCode.cn/images/m02.jpg "></a>
 <a href= " javascript:alert('3') "><img src= " http://www.CsrCode.cn/images/m03.jpg "></a>
 <a href= " javascript:alert('4') "><img src= " http://www.CsrCode.cn/images/m04.jpg "></a>
 <a href= " javascript:alert('5') "><img src= " http://www.CsrCode.cn/images/m05.jpg "></a>
 <a href= " javascript:alert('6') "><img src= " http://www.CsrCode.cn/images/m06.jpg "></a>
 <a href= " javascript:alert('7') "><img src= " http://www.CsrCode.cn/images/m07.jpg "></a>
 <a href= " javascript:alert('8') "><img src= " http://www.CsrCode.cn/images/m08.jpg "></a>
 <a href= " javascript:alert('9') "><img src= " http://www.CsrCode.cn/images/m09.jpg "></a>
</div>
<script language= " javascript ">
new $o.slide( " aa ");
</script>
<br>
<div id= " bb " style= " width:402px;height:228px; ">
 <a href= " # "><img src= " http://www.CsrCode.cn/images/m01.jpg "></a>
 <a href= " # "><img src= " http://www.CsrCode.cn/images/m02.jpg "></a>
 <a href= " # "><img src= " http://www.CsrCode.cn/images/m03.jpg "></a>
 <a href= " # "><img src= " http://www.CsrCode.cn/images/m04.jpg "></a>
 <a href= " # "><img src= " http://www.CsrCode.cn/images/m05.jpg "></a>
</div>
<script language= " javascript ">
new $o.slide( " bb ",{color: ' #000 ',time: 0.2});
</script>
<br>
<div id= " cc " style= " width:402px;height:228px; ">
 <a href= " # "><img src= " http://www.CsrCode.cn/images/m05.jpg "></a>
 <a href= " # "><img src= " http://www.CsrCode.cn/images/m06.jpg "></a>
 <a href= " # "><img src= " http://www.CsrCode.cn/images/m07.jpg "></a>
 <a href= " # "><img src= " http://www.CsrCode.cn/images/m08.jpg "></a>
 <a href= " # "><img src= " http://www.CsrCode.cn/images/m09.jpg "></a>
</div>
<script language= " javascript ">
new $o.slide( " cc ",{color: ' green '});
</script>
</body>
</html>

<br><br><hr><p align= " center "><font color=black>本特效由 <a target= " _blank " href= " http://www.CsrCode.cn " target= " _blank ">芯晴网页特效</a>丨CsrCode.Cn 收集于互联网,只为兴趣与学习交流,不作商业用途。</font></p>

转载于:https://www.cnblogs.com/csr04/archive/2012/08/24/2654185.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值