js层级轮播图兼容IE8及以上浏览器

预览
本轮播图兼容ie8+浏览器,精华部分js+css,什么定时轮播,什么旋转,全部实现!
js层级轮播图兼容IE8及以上浏览器_第1张图片

html代码


js代码


最重要的css代码来了,有两部分吆! 重点在p1-p7部分

1):css3编写的
*{margin:0;padding:0}
.box{margin-top:80px;width:100%;height:340px;position:relative}
.list{width:1200px;height:300px;overflow:hidden;position:absolute;left:50%;margin-left:-600px}
.btn{position:absolute;top:50%;margin-top:-50px;width:60px;height:100px;line-height:100px;font-size:30px;color:white;text-decoration:none;text-align:center;background:rgba(0,255,0,.5);cursor:pointer}
.next{right:0}
li{position:absolute;top:0;left:0;list-style:none;opacity:0;transition:all .3s ease-out}
img{width:751px;height:300px;border:0;float:left}
.p1{transform:translate3d(-224px,0,0) scale(0.81)}
.p2{transform:translate3d(0px,0,0) scale(0.81);transform-origin:0 50%;opacity:.8;z-index:2}
.p3{transform:translate3d(224px,0,0) scale(1);z-index:3;opacity:1}
.p4{transform:translate3d(449px,0,0) scale(0.81);transform-origin:100% 50%;opacity:.8;z-index:2}
.p5{transform:translate3d(672px,0,0) scale(0.81)}
.p6{transform:translate3d(896px,0,0) scale(0.81)}
.p7{transform:translate3d(1120px,0,0) scale(0.81)}
.buttons{position:absolute;width:1200px;height:30px;bottom:0;left:50%;margin-left:-600px;text-align:center;padding-top:10px}
.buttons a{display:inline-block;width:35px;height:5px;padding-top:4px;cursor:pointer}
span{display:block;width:35px;height:1px;background:red}
.blue{background:blue}

2):css2编写的,可以支持ie8及以上浏览器
img{width:100%;height:100%}
.box{width:100%;height:416px;position:relative}
.box .list{width:1200px;height:300px;overflow:hidden;position:absolute;top:60px;left:50%;margin-left:-600px}
.box .btn{position:absolute;width:22px;height:23px;line-height:24px;font-size:30px;color:white;text-decoration:none;text-align:center;background:rgba(0,255,0,.5);cursor:pointer}
.box .prev{background:url("img/b_l.png") no-repeat;bottom:8px;left:40%;z-index:10}
.box .next{background:url("img/b_r.png") no-repeat;bottom:8px;right:40%;z-index:10}
.box .list li{position:absolute;list-style:none;opacity:0;transition:all .3s ease-out}
.box .list li img{border:0;float:left}
.box .list li.p1{z-index:0;left:34px;top:41px;opacity:1;width:379px;height:218px}
.box .list li.p2{z-index:1;opacity:1;left:124px;top:28.8889px;width:421px;height:242px}
.box .list li.p3{z-index:2;width:467.901px;height:269.136px;opacity:1;left:230px;top:15.4321px}
.box .list li.p4{top:0;left:340px;width:520px;height:300px;z-index:3;opacity:1}
.box .list li.p5{z-index:2;width:468px;height:270px;right:230px;top:15px;opacity:1}
.box .list li.p6{z-index:1;opacity:1;right:124px;top:28.5px;width:421px;height:242px}
.box .list li.p7{z-index:0;opacity:1;right:34px;top:40.65px;width:379px;height:218px}
.box .list li span{position:absolute;bottom:0;left:0;display:block;height:50px;background-color:rgba(32,58,130,0.6);line-height:50px;font-size:16px;color:#fff;width:100%;text-align:center}
.box .list li a{width:100%;height:100%;display:block;z-index:10}
.box .list li i{background:url("img//sjx.png") no-repeat;position:absolute;bottom:46%;left:48%;width:60px;height:60px}
.box .buttons{position:absolute;width:1200px;height:30px;bottom:0;left:50%;margin-left:-600px;text-align:center;padding-top:10px}
.box .buttons a{display:inline-block;text-align:center;cursor:pointer}
.box .buttons span{display:block;width:10px;height:10px;background:url("img/por.png") no-repeat;margin:0 auto}
.box .buttons span.blue{width:22px;background:url("img/por_w.png") no-repeat}

你可能感兴趣的:(前端,轮播图,层级,支持ie8,兼容)