TA的每日心情 | 开心 2019-11-18 11:03 |
---|
签到天数: 1 天 [LV.1]初来乍到
新手上路

- 积分
- 15
|
板凳

楼主 |
发表于 2019-11-18 15:52:57
|
只看该作者
自己解决了,代码:
<!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 charset="utf-8">
<title>Swiper demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<link rel="stylesheet" href="css/swiper.css">
<style>
html, body {
position: relative;
height: 100%;
}
body {
background: #eee;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
font-size: 14px;
color:#000;
margin: 0;
padding: 0;
}
/*---图片---*/
.swiper-container {
width: 750px;
height: 300px;
overflow:hidden;
background-color:#00CCFF;
}
.swiper-slide {
width:630px;
height:300px;
display: block;
display: -webkit-box;
display: -ms-flexbox;
display: -webkit-flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
-webkit-justify-content: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
-webkit-align-items: center;
align-items: center;
transition: 300ms;
}
.swiper-slide img{
border-radius: 20px;
width:630px;
height:300px;
}
.swiper-slide-active img,
.swiper-slide-duplicate-active img{
}
.swiper-slide-prev img,
.swiper-slide-next img{
width:525px;
height:250px;
}
.swiper-slide-prev img{
margin-right:-90px;
}
.swiper-slide-next img{
margin-left:-90px;
}
/*---页码---*/
.swiper-pagination-bullet{
width: 19px;
height: 10px;
background: url(images/banner_page1.png);
border-radius: 0px;
opacity:1;
}
.swiper-pagination-bullet-active{
width: 38px;
height: 10px;
background: url(images/banner_page2.png);
}
</style>
</head>
<body>
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide"><img src="images/1.jpg" /></div>
<div class="swiper-slide"><img src="images/2.jpg" /></div>
<div class="swiper-slide"><img src="images/3.jpg" /></div>
</div>
<div class="swiper-pagination"></div>
</div>
<script src="js/swiper.js"></script>
<script>
var swiper = new Swiper('.swiper-container', {
centeredSlides: true, //居中
slidesPerView: 'auto', //容器中显示的图片数量
spaceBetween: 20, //图片间隔
loop: true, //循环播放
//autoplay: true, //自动播放
//delay: 3000, //停留时间,毫秒
pagination: {
el: '.swiper-pagination',
clickable: true,
},
});
</script>
</body>
</html>
|
|