<link rel="stylesheet" href="../js/swiper.css">
<style>
.swiper-container,
.swiper-wrapper,
img{
width: 320px;
height: 200px;
}
</style>
</head>
<body>
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide"><img src="../img/1.jpg" alt=""></div>
<div class="swiper-slide"><img src="../img/2.jpg" alt=""></div>
<div class="swiper-slide"><img src="../img/3.jpg" alt=""></div>
</div>
<!-- 如果需要分页器 -->
<div class="swiper-pagination"></div>
<!-- 如果需要滚动条 -->
<div class="swiper-scrollbar"></div>
</div>
<script src="../js/swiper.min.js"></script>
<script>
// 参数一 swiper 容器 选择器
new Swiper(".swiper-container",{
// 是否开启循环模式
loop:true,
// 切换特效
effect:"cube",
// 分页器 就是轮播图下面的那个点
// 上面轮播模板分页 写的是什么,复制过来
pagination:".swiper-pagination",
// 滚动条
scrollbars:".swiper-scrollbar"
})
</script>
</body>
需要官网下载swiper.css和swiper.min.js插件,进行引用。