swiper 自定义分页器显示_swiper自定义分页器使用方法

var mySwiper = new Swiper ('.swiper-container', {

direction:"horizontal",/*横向滑动*/

loop: true,  //设置为true 则开启loop模式

autoplay: true,  //设置为true启动自动切换,并使用默认的切换设置

speed: 300,  //切换速度,即slider自动滑动开始到结束的时间(单位ms),也是触摸滑动时释放至贴合的时间

autoplay: {

disableOnInteraction: false,//手势滑动过以后,依然能够重启轮播的属性

},

// 如果需要分页器

pagination: {

el: '.swiper-pagination',

type: 'custom',

renderCustom: function (swiper, current, total) {

var customPaginationHtml = "";

for(var i = 0; i < total; i++) {

//判断哪个分页器此刻应该被激活

if(i == (current - 1)) {

customPaginationHtml += '';

} else {

customPaginationHtml += '';

}

}

return customPaginationHtml;

}

},

});

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值