JS全屏通栏自适应宽度焦点图代码Swiper演示下载

代码笔记       92.9KB      2018-11-05 09:12:18    

除了要引入js文件,还需要自定义js代码
 
window.onload = function() {
var swiper = new Swiper('.swiper-container',{
autoplay: false, 是否自动播放 为false的时候不会自动播放.可以修改为true试试.
speed: 1000,  //图片自动切换的速度,如果数字越大,切换的速度就越快.
autoplayDisableOnInteraction: false,
loop: true, 是否循环
centeredSlides: true,
slidesPerView: 2,
pagination: '.swiper-pagination',
paginationClickable: true,
prevButton: '.swiper-button-prev',
nextButton: '.swiper-button-next',
onInit: function(swiper) {
swiper.slides[2].className = "swiper-slide swiper-slide-active";
},
breakpoints: {
668: {
slidesPerView: 1,
}
}
});
}

 
效果预览 打赏