$(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); }) })