progress: function(progress) {
for (i = 0; i < this.slides.length; i++) {
var slide = this.slides.eq(i);
var slideProgress = this.slides[i].progress;
if (Math.abs(slideProgress) > 1) {
var modify = (Math.abs(slideProgress) - 1) * 0.4 + 1;
}
translate = slideProgress * modify * 318 + 'px';
scale = 1 - Math.abs(slideProgress) / 5;
zIndex = 999 - Math.abs(Math.round(10 * slideProgress));
slide.transform('translateX(' + translate + ') scale(' + scale + ')');
slide.css('zIndex', zIndex);
slide.css('opacity', 1);
if (Math.abs(slideProgress) > 3) {
slide.css('opacity', 0);
}
}
}此为设置两边渐小的图片大小的代码
当前演示就是自动播放的。autoplay: true,但点击切换后会停止,修改以下
var mySwiper = new Swiper("#banner", {
autoplay: {
disableOnInteraction: false, //默认true
delay: 2000, //默认3000
},
loopedSlides: 5,
slidesPerView: 'auto',
loop: true,
centeredSlides: true,
initialSlide: 2,
watchSlidesProgress: true,
disableOnInteraction: false,
pagination: {
el: '.banner_page',
clickable: true,
},