$(function () { var mySwiper = new Swiper('.swiper', { direction: 'horizontal', loop: true, // speed:1000, effect: 'fade', parallax: true, pagination: { el: '.swiper-pagination', type: 'custom', renderCustom: function (swiper, current, total) { var dangqian = document.querySelector(".dangqian") var zongshu = document.querySelector(".zongshu") if (current <= 9) { current = "0" + current } else { current = current } if (total <= 9) { total = "0" + total } else { total = total } dangqian.innerText = current zongshu.innerText = total } }, lazy: { loadPrevNext: true, }, navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, observer: true, observeParents: true, on: { init: function () { swiperAnimateCache(this); this.emit('transitionEnd'); }, transitionEnd: function () { swiperAnimate(this); }, } }) // var swiper1 = new Swiper(".Swiper1", { // loop: false, // grabCursor: true, // speed: 1000, // navigation: { // nextEl: ".next1", // prevEl: ".prev1", // }, // observer: true, // observeParents: true, // pagination: { // el: '.one', // type: 'progressbar' // }, // lazy: { // loadPrevNext: true, // }, // on: { // init: function () { // swiperAnimateCache(this); //隐藏动画元素 // swiperAnimate(this); //初始化完成开始动画 // }, // slideChangeTransitionEnd: function () { // swiperAnimate(this); //每个slide切换结束时也运行当前slide动画 // } // } // }); var select = $('.change .changeNav'); var text = $('.change-text p'); select.click(function () { let $this = $(this); let i = $this.index(); $this.addClass('active'); $this.siblings().removeClass('active'); text.eq(i).addClass('textActive'); text.eq(i).siblings().removeClass('textActive'); // swiper1.slideTo($this.index(), 1000, true); }) })