次 }, navigation: { nextEl: ".swiper-next", prevEl: ".swiper-prev", }, }); var swiper = new Swiper(".swiper-service", { slidesPerView: 1, spaceBetween: 30, slidesPerGroup: 1, loop: true, autoplay: { delay: 3000, //1秒切换一次 }, navigation: { nextEl: ".swiper-next", prevEl: ".swiper-prev", }, }); var mySwiper = new Swiper('.swiper-container', { on: { init: function() { swiperAnimateCache(this); //隐藏动画元素 swiperAnimate(this); //初始化完成开始动画 }, slideChangeTransitionEnd: function() { swiperAnimate(this); //每个slide切换结束时也运行当前slide动画 } }, pagination: { el: '.swiper-pagination' }, direction: 'vertical', loop: true, effect: 'fade', speed: 1800, autoplay: { delay: 4000, stopOnLastSlide: false, disableOnInteraction: true, }, }); function slidePrev() { mySwiper.slidePrev(); $('.paginationdisc span').css('background-color', '#ccc'); $('#jump' + mySwiper.activeIndex).css('background-color', '#fff'); } function slideNext() { mySwiper.slideNext(); // alert(mySwiper.activeIndex); $('.paginationdisc span').css('background-color', '#ccc'); $('#jump' + mySwiper.activeIndex).css('background-color', '#fff'); } function slideJump(i) { mySwiper.slideTo(i); $('.paginationdisc span').css('background-color', '#ccc'); $('#jump' + i).css('background-color', '#fff'); }