126 lines
3.4 KiB
HTML
126 lines
3.4 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>轮播图</title>
|
|
<link rel="stylesheet" href="http://at.alicdn.com/t/c/font_3889063_w9zrujr1cf.css">
|
|
<style>
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
list-style: none;
|
|
border: 0;
|
|
}
|
|
|
|
.banner {
|
|
width: 560px;
|
|
height: 315px;
|
|
background: rgb(190, 165, 165);
|
|
margin: 0 auto;
|
|
overflow: hidden;
|
|
position: relative;
|
|
}
|
|
|
|
.banner .banner_ul {
|
|
display: flex;
|
|
position: absolute;
|
|
transition: all 1s;
|
|
}
|
|
|
|
.banner_ul li {
|
|
width: 560px;
|
|
height: 315px;
|
|
}
|
|
|
|
.banner_ul li img {
|
|
width: 560px;
|
|
height: 315px;
|
|
}
|
|
|
|
.button {
|
|
width: 100%;
|
|
position: absolute;
|
|
top: 50%;
|
|
transform: translateY(-50%);
|
|
display: flex;
|
|
justify-content: space-between;
|
|
font-size: 30px;
|
|
}
|
|
|
|
.button div {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
width: 40px;
|
|
height: 50px;
|
|
background: #00000061;
|
|
font-size: 20px;
|
|
color: #fff;
|
|
cursor: pointer;
|
|
}
|
|
.button div:last-child{
|
|
transform: rotate(-90deg);
|
|
}
|
|
.banner_dot {
|
|
position: absolute;
|
|
bottom: 5px;
|
|
left: 50%;
|
|
transform: translatey(-50%);
|
|
width: 100%;
|
|
display: flex;
|
|
}
|
|
|
|
.banner_dot i {
|
|
width: 13px;
|
|
height: 13px;
|
|
border-radius: 50%;
|
|
background: #fff;
|
|
margin-left: 5px;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.banner_dot i:first-child {
|
|
margin-left: 0;
|
|
}
|
|
|
|
.banner_dot .active {
|
|
background: red;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class=" swiper banner">
|
|
<ul class="banner_ul" style="left: 0px">
|
|
<li><img src="https://img.alicdn.com/imgextra/i4/6000000001058/O1CN017HPzlT1Jgbr6Rvc4X_!!6000000001058-0-octopus.jpg"
|
|
alt=""></li>
|
|
<li><img src="https://img.alicdn.com/imgextra/i4/6000000003739/O1CN01ks7Fjr1dUVhwWXLWB_!!6000000003739-0-octopus.jpg"
|
|
alt=""></li>
|
|
<li><img src="https://img.alicdn.com/imgextra/i1/6000000003795/O1CN01g3s9jf1du9t00iRTU_!!6000000003795-0-octopus.jpg"
|
|
alt=""></li>
|
|
</ul>
|
|
<div class="button">
|
|
<div class="button_left iconfont icon-zhankai-copy"></div>
|
|
<div class="button_right iconfont icon-zhankai"></div>
|
|
</div>
|
|
<div class="banner_dot">
|
|
<!-- <i class="active"></i>
|
|
<i></i>
|
|
<i></i> -->
|
|
</div>
|
|
</div>
|
|
</body>
|
|
<script src="./swiper.js"></script>
|
|
<script>
|
|
// 第一个参数 是 最外层 父元素类名
|
|
//第二个是允许用户自定义插件的参数
|
|
var a = new Swiper(".banner",{
|
|
|
|
autoPlay: false,//是否自动播放
|
|
time:2000,//定时自动切换
|
|
initialSlide:0,//默认显示第几张
|
|
})
|
|
|
|
</script>
|
|
</html> |