Files
ClassContent/项目合集/轮播图/笔记.txt
2024-09-27 02:06:13 +08:00

64 lines
1.1 KiB
Plaintext
Raw 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.

1:定位修改left数值
2:css3 平移实现移动
实现的功能:
自定义参数:
1:loop: 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',
},
【完成】5:initialSlide: 0(默认) 设置显示第几张图
功能(方法):
1:slideChange() 轮播图切换的时候,调用这个方法,返回下标
new Swiper('.swiper-container',{
on:{
slideChange: function(){
alert('改变了,activeIndex为'+this.activeIndex);
},
},
})
mySwiper.on('slideChange', function () {
//...
});
var slideChange = function () {
}
var a = {
slideChange: function () {
},
ddd: fun
}
2:slideTo(index) 传入参数,切换轮播图