完整页面代码如下,赋值到html页面用浏览器打开就可以预览图片轮播效果:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<style type="text/css">
/*图片轮播*/
.box{
margin-top: 20px;
margin-left: 40px;
height: 180px;
background-color: white;
position: relative;
float: left;
}
.list{
width: 300px;
height: 150px;
overflow: hidden;
margin: 5px;
}
.next{
right: 0;
}
.list li{
position: absolute;
top: 0;
left: 0;
list-style: none;
opacity: 0;
transition: all 0.3s ease-out;
}
.list img{
border: 1px solid #DDD;
float: left;
}
.list .p1{
transform:translate3d(-100px,0,0) scale(0.70);
}
.list .p2{
transform:translate3d(0px,0,0) scale(0.70);
transform-origin:0 50%;
opacity: 0.8;
z-index: 2;
}
.list .p3{
transform:translate3d(100px,0,0) scale(1);
z-index: 3;
opacity: 1;
}
.list .p4{
transform:translate3d(200px,0,0) scale(0.70);
transform-origin:100% 50%;
opacity: 0.8;
z-index: 2;
}
.list .p5{
transform:translate3d(300px,0,0) scale(0.70);
}
.list .p6{
transform:translate3d(400px,0,0) scale(0.70);
}
.list .p7{
transform:translate3d(500px,0,0) scale(0.70);
}
.buttons{
/* width: 600px;*/
height: 30px;
bottom: 0;
margin-left: 0px;
text-align: center;
padding-top: 10px;
}
.buttons a{
display: inline-block;
width: 35px;
height: 5px;
padding-top: 4px;
cursor: pointer;
}
.buttons span{
display: block;
width: 35px;
height: 1px;
background: #DDDDDD;
}
.buttons .blue{
background: #62a60a;
}
/*图片轮播结束*/
</style>
<title>图片轮播演示</title>
<script>
js代码:http://www.yayihouse.com/yayishuwu/chapter/2467
</script>
</head>
<body>
<div class="box">
<div class="list" >
<ul>
<li class="p1"><a href=""><img src="/static/images/survey_02.png" alt="" width="300" height="150" /></a></li>
<li class="p2"><a href=""><img src="/static/images/survey_02.png" alt="" width="300" height="150" /></a></li>
<li class="p3"><a href=""><img src="/static/images/survey_02.png" alt="" width="300" height="150" /></a></li>
<li class="p4"><a href=""><img src="/static/images/survey_02.png" alt="" width="300" height="150" /></a></li>
<li class="p5"><a href=""><img src="/static/images/survey_02.png" alt="" width="300" height="150" /></a></li>
<li class="p6"><a href=""><img src="/static/images/survey_02.png" alt="" width="300" height="150" /></a></li>
<li class="p7"><a href=""><img src="/static/images/survey_02.png" alt="" width="300" height="150" /></a></li>
</ul>
</div>
<div class="buttons">
<a href="javascript:;"><span></span></a>
<a href="javascript:;"><span></span></a>
<a href="javascript:;"><span></span></a>
<a href="javascript:;"><span></span></a>
<a href="javascript:;"><span></span></a>
<a href="javascript:;"><span></span></a>
<a href="javascript:;"><span></span></a>
</div>
</div>
</body>
</html>