当前位置:网站首页>swiper——单页面多轮播插件冲突解决方案
swiper——单页面多轮播插件冲突解决方案
2022-06-11 21:54:00 【Nanchen_42】
第一个轮播图写法:最外层盒子一定要加swiper-container,之后在新写一类用来区分两个轮播图,在swiper-pagination也就是小圆点的位置添加一个属性名,样式要定义在你新建的类名上面
<!-- 轮播图 -->
<div class="swiper-container swiperone">
<div class="swiper-wrapper">
<div class="swiper-slide"></div>
<div class="swiper-slide swiper-two">
<img src="./image/zd-project01/矩形 584 拷贝.png" alt="">
<h1>精准预约</h1>
<p>基于大数据精确测算不同专科、不同专家
接诊时间,实现科室号源预约时段精确到
30分钟以内,并基于智能分诊知识库,为
患者提供智能在线分诊推荐。</p>
</div>
<div class="swiper-slide"></div>
</div>
<!-- Add Pagination -->
</div>
<div class="next swiper-pagination"></div>第二张同理:
<div class="swiper-container swipertwo">
<div class="swiper-wrapper">
<div class="swiper-slide"></div>
<div class="swiper-slide swiper-two">
<img src="./image/zd-project01/矩形 584 拷贝.png" alt="">
<h1>精准预约</h1>
<p>基于大数据精确测算不同专科、不同专家
接诊时间,实现科室号源预约时段精确到
30分钟以内,并基于智能分诊知识库,为
患者提供智能在线分诊推荐。</p>
</div>
<div class="swiper-slide"></div>
</div>
<!-- Add Pagination -->
</div>
<div class="next2 swiper-pagination"></div>样式的话用轮播二来举例:样式前缀为你新添加的样式名称
/* !轮播二 */
.swipertwo {
width: 100%;
height: 5.5rem;
margin: .46rem auto;
overflow: hidden;
}
.swipertwo .swiper-slide {
text-align: center;
font-size: 18px;
background: #fff;
transform: scale(0.8) !important;
transition: all .5s;
}
.swipertwo .swiper-slide:nth-child(1) {
background-image: url(../image/zd-project01/3.png);
background-size: 100% 100%;
}
.swipertwo .swiper-slide-active,
.swipertwo .swiper-slide-duplicate-active {
transform: scale(1) !important;
}
.swipertwo .swiper-slide:nth-child(2n) {
width: 5.5rem;
}
.swipertwo .swiper-slide:nth-child(3) {
width: 5.5rem;
background: url(../image/zd-project01/2.png);
background-size: 100% 100%;
}
.next2{
top: -.3rem !important;
position: relative !important;
}
.next2 .swiper-pagination-bullet {
width: .3rem !important;
height: .08rem !important;
border-radius: .04rem !important;
margin-left: .08rem !important;
background: #0D80DD;
}
.next2 .swiper-pagination-bullet-active {
width: .3rem;
height: .08rem;
border-radius: .04rem;
background: #0D80DD;
}swiper.js部分:把需要替换的轮播图名称和列表项替换即可
var swiper = new Swiper('.swiperone', {
pagination: '.next',
slidesPerView: 2,
observer: true,
observeParents: true,
initialSlide: 1,//默认第二个
centeredSlides: true,
paginationClickable: true,
spaceBetween: 5, observer: true,//修改swiper自己或子元素时,自动初始化swiper
observeParents: true,//修改swiper的父元素时,自动初始化swiper
// noSwiping: true, //设置为true时禁止切换
slideToClickedSlide: true,
});
var swiper2 = new Swiper('.swipertwo', {
pagination: '.next2',
slidesPerView: 2,
observer: true,
observeParents: true,
initialSlide: 2,//默认第二个
centeredSlides: true,
paginationClickable: true,
spaceBetween: 5, observer: true,//修改swiper自己或子元素时,自动初始化swiper
observeParents: true,//修改swiper的父元素时,自动初始化swiper
// noSwiping: true, //设置为true时禁止切换
slideToClickedSlide: true,
});最后一点,要在js添加以下两行代码
observer: true,//修改swiper自己或子元素时,自动初始化swiper
observeParents: true,//修改swiper的父元素时,自动初始化swiper边栏推荐
- C language to achieve eight sorts (2)
- Optimization of quick sort
- 3.2 测试类的命名规则
- How to use the transaction code sat to find the name trial version of the background storage database table corresponding to a sapgui screen field
- inner join执行计划变了
- LeetCode栈题目总结
- 一款开源的Markdown转富文本编辑器的实现原理剖析
- C语言实现八种排序(1)
- Internet of things development practice 18 scenario linkage: how does an intelligent light perceive light? (I) (learning notes)
- 69. x的平方根
猜你喜欢

Tkinter学习笔记(二)

每日一题 - 罗马数字转整数

Maze problem in C language

【LeetCode】11. Container with the most water

类和对象(2)
![[Yu Yue education] calculus of Zhejiang University in autumn and winter 2021 (I) reference materials](/img/0a/58df3fd771d58c66245397d131fa53.png)
[Yu Yue education] calculus of Zhejiang University in autumn and winter 2021 (I) reference materials

Nmap进行主机探测出现网段IP全部存活情况分析

Nmap performs analysis of all network segment IP survivals in host detection

The shortcomings of the "big model" and the strengths of the "knowledge map"

Superscalar processor design yaoyongbin Chapter 2 cache -- Excerpt from subsection 2.3
随机推荐
重温c语言一
One question of the day - delete duplicates of the ordered array
B. Phoenix and Beauty
238. product of arrays other than itself
类和对象(4)
Internet of things development practice 18 scenario linkage: how does an intelligent light perceive light? (I) (learning notes)
学习位段(1)
[Yu Yue education] Yancheng Normal University Advanced Algebra reference
Learning bit segment (1)
Tkinter学习笔记(二)
Daily question - Roman numeral to integer
Dynamic memory management (1)
Summary of common paging methods
The shortcomings of the "big model" and the strengths of the "knowledge map"
2022-02-28(2)
带有 ceph-csi 的静态 PVC
Players must read starfish NFT advanced introduction
Two methods to judge the storage of large and small end
5.学城项目 支付宝支付
Example of using zypper command