当前位置:网站首页>Swiper系列之轮播图
Swiper系列之轮播图
2022-08-02 11:51:00 【老__L】
1、引入 CSS 文件
<link rel="stylesheet" href="./swiper/swiper-bundle.min.css" />
2、引入 js 文件
<script src="./swiper/swiper-bundle.min.js"></script>
3、页面布局
<!-- Swiper -->
<div class="slider swiper">
<div class="swiper-wrapper">
<div class="swiper-slide">
<img src="./img/slider1.png" alt="" />
</div>
<div class="swiper-slide">
<img src="./img/slider1.png" alt="" />
</div>
<div class="swiper-slide">
<img src="./img/slider1.png" alt="" />
</div>
<div class="swiper-slide">
<img src="./img/slider1.png" alt="" />
</div>
<div class="swiper-slide">
<img src="./img/slider1.png" alt="" />
</div>
<div class="swiper-slide">
<img src="./img/slider1.png" alt="" />
</div>
<div class="swiper-slide">
<img src="./img/slider1.png" alt="" />
</div>
<div class="swiper-slide">
<img src="./img/slider1.png" alt="" />
</div>
</div>
<div class="swiper-pagination"></div>
</div>
4、js 逻辑编写
var swiper = new Swiper(".slider", {
autoplay: {
delay: 1000,
// loop: true,
stopOnLastSlide: false,
disableOnInteraction: false,
observer: true, //开启动态检查器,监测swiper和slide
observeParents: true //监测Swiper 的祖/父元素
},
pagination: {
el: ".swiper-pagination"
}
});
后记
如果你感觉文章不咋地
//(ㄒoㄒ)//
,就在评论处留言,作者继续改进;o_O???
如果你觉得该文章有一点点用处,可以给作者点个赞;\\*^o^*//
如果你想要和作者一起进步,可以微信扫描二维码,关注前端老L;~~~///(^v^)\\\~~~
谢谢各位读者们啦(^_^)∠※
!!!
边栏推荐
猜你喜欢
随机推荐
DTG-SSOD:最新半监督检测框架,Dense Teacher(附论文下载)
CAN总线的AUTOSAR网络管理
力扣27-移除元素——简单题
细学常用类,集合类,IO流
Crack detection technology based on deep learning
观察者(observer)模式(二) —— 实现线程安全的监听器
力扣977-有序数组的平方——暴力法&双指针法
Oracle 单实例19.11升级到19.12
记录代码
【Acunetix-Forgot your password】
SQL function TRIM
Running yum reports Error: Cannot retrieve metalink for reposit
npm WARN config global `--global`, `--local` are deprecated. Use `--location解决方案
学习经验分享之七:YOLOv5代码中文注释
AQS-AbstractQueuedSynchronizer
Solve the problem of Chinese garbled characters in exporting excel file names
npm run serve启动报错npm ERR Missing script “serve“
面积曲线AUC(area under curve)
When not to use () instead of Void in Swift
基于threejs的商品VR展示平台的设计与实现思路