$(function () { let product = 3,spaceBetween = 30; if(window.innerWidth <= 768){ product = 1; spaceBetween = 0 } //banner var bannerSwiper = new Swiper ('.banner-wrapper', { autoplay: { delay: 4000, stopOnLastSlide: false, disableOnInteraction: false, }, autoplayDisableOnInteraction : false, /* effect : 'fade', fadeEffect: { crossFade: true, },*/ loop: true, // 寰幆妯″紡閫夐」 // 濡傛灉闇€瑕佸垎椤靛櫒 pagination: { el: '.swiper-pagination', clickable :true, }, observer:true,//淇敼swiper鑷繁鎴栧瓙鍏冪礌鏃讹紝鑷姩鍒濆鍖杝wiper observeParents:true,//淇敼swiper鐨勭埗鍏冪礌鏃讹紝鑷姩鍒濆鍖杝wiper on: { slideChangeTransitionStart: function(){ $(".progress-bar").removeClass("progress-ani"); var index = this.realIndex; $('.swiper-pagination') .find('span') .eq(index) .addClass('swiper-pagination-bullet-active') .siblings() .removeClass('swiper-pagination-bullet-active'); }, slideChangeTransitionEnd: function(){ $(".progress-bar").addClass("progress-ani"); }, }, }); $(".text-btn button").hover(function () { bannerSwiper.autoplay.stop(); },function () { bannerSwiper.autoplay.start(); }); $(".video-btn").click(function () { showVideo() }); //浜у搧鐗规€ /* 瀹氫箟浜у搧杞挱鍥 */ var swiper = new Swiper('.product-swiper', { loop: false, //initialSlide: 1, slidesPerView: product, spaceBetween: spaceBetween, navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, on:{ }, }); /* 瀹氫箟鍚堜綔浼欎即杞挱鍥 */ var swiper1 = new Swiper('.partner-swiper', { slidesPerView: 1, speed: 1000, spaceBetween: 0, navigation: { nextEl: '.swiper-button-next1', prevEl: '.swiper-button-prev1', }, freeMode: true,//浣夸箣绉诲姩姣旇緝椤烘粦锛屾湁鎯€ }); });