Files
2024-09-27 02:06:13 +08:00

49 lines
1.1 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

实现的功能:
自定义参数:
【完成】1loop: false // 循环模式选项
【完成】2自动播放
autoPlay: true // false
autoTime: 3(默认) 用户可以自定义
【完成】3是否需要前进后退按钮
如果需要
1写上html
2
// 如果需要前进后退按钮
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
【完成】4是否需要小圆点
如果需要
1写上html
2
pagination: {
el: '.swiper-pagination',
},
【完成】5initialSlide: 0(默认) 设置显示第几张图
【完成】6speed: 300(默认) 设置图片切换的速度
7direction: horizontal(默认) 播放的方向 vertical
功能(方法):
1slideChange() 轮播图切换的时候,调用这个方法,返回下标
new Swiper('.swiper-container',{
on:{
slideChange: function(){
alert('改变了activeIndex为'+this.activeIndex);
},
},
})
mySwiper.on('slideChange', function () {
//...
});
2slideTo(index) 传入参数,切换轮播图
3: stop() start() 停止,开始自动播放