$(function(){ // banner 轮播 var idxNewSap = new Swiper('.idxNewSap', { slidesPerView: 1, spaceBetween: 15, centeredSlides: false, loop: true, loopedSlides: 5, speed: 500, autoplay: { delay: 3000, disableOnInteraction: false, }, navigation: { nextEl: '.idxNewSap-nt', prevEl: '.idxNewSap-pv', }, observer: true, observeParents: true, pagination: { el: '.idxNewSapPage', clickable: true, }, breakpoints: { 1200: { slidesPerView: 3, spaceBetween: 75, }, 1024: { slidesPerView: 3, spaceBetween: 35, }, 680: { slidesPerView: 2, spaceBetween: 15, } }, }); // var idxNewSap = new Swiper('.idxNewSap.mbl', { // slidesPerView: 1, // spaceBetween: 15, // centeredSlides: false, // loop: true, // loopedSlides: 5, // speed: 800, // autoplay: { // delay: 5000, // disableOnInteraction: false, // }, // pagination: { // el: '.mbl .idxNewSapPage', // clickable: true, // }, // observer: true, // observeParents: true, // breakpoints: { // 1200: { // spaceBetween: 75, // }, // 1200: { // slidesPerView: 3, // spaceBetween: 35, // } // }, // }); // var pgImgSwp1 = new Swiper('.pgImgSwp1', { slidesPerView: 1, spaceBetween: 0, centeredSlides: false, loop: false, speed: 800, navigation: { nextEl: '.pgImgSwp1-nt', prevEl: '.pgImgSwp1-pv', }, observer: true, observeParents: true, pagination: { el: '.pgImgSwp1 .pgImgSwp-pg', clickable: true, }, }); var pgImgSwp2 = new Swiper('.pgImgSwp2', { slidesPerView: 1, spaceBetween: 0, centeredSlides: false, loop: false, speed: 800, navigation: { nextEl: '.pgImgSwp2-nt', prevEl: '.pgImgSwp2-pv', }, observer: true, observeParents: true, pagination: { el: '.pgImgSwp2 .pgImgSwp-pg', clickable: true, }, }); var pgImgSwp3 = new Swiper('.pgImgSwp3', { slidesPerView: 1, spaceBetween: 0, centeredSlides: false, loop: false, speed: 800, navigation: { nextEl: '.pgImgSwp3-nt', prevEl: '.pgImgSwp3-pv', }, observer: true, observeParents: true, pagination: { el: '.pgImgSwp3 .pgImgSwp-pg', clickable: true, }, }); var pgImgSwp2 = new Swiper('.pgImgSwp4', { slidesPerView: 1, spaceBetween: 0, centeredSlides: false, loop: false, speed: 800, navigation: { nextEl: '.pgImgSwp4-nt', prevEl: '.pgImgSwp4-pv', }, observer: true, observeParents: true, pagination: { el: '.pgImgSwp4 .pgImgSwp-pg', clickable: true, }, }); var proTabnav; $(".proTab-nav").each(function(){ var _this = $(this); if(_this.find(".swiper-slide").length < 3){ $(".spanl").hide(); $(".spanr").hide(); _this.addClass("centers"); $(".centers .swiper-slide").eq(0).addClass("swiper-slide-active") $(".centers .swiper-slide").click(function(){ var _thisIdx = $(this).index(); $(this).addClass("swiper-slide-active").siblings(".swiper-slide").removeClass("swiper-slide-active"); $(".proTabBy-li").eq(_thisIdx).fadeIn(); $(".proTabBy-li").eq(_thisIdx).siblings(".proTabBy-li").hide(); }) }else{ proTabnav = new Swiper('.proTab-nav', { slidesPerView: 1.5, spaceBetween: 20, centeredSlides: true, loop: true, speed: 800, observer: true, observeParents: true, breakpoints: { 680: { slidesPerView: 3, spaceBetween: 100, } }, navigation: { nextEl: '.proTab .btnRight', prevEl: '.proTab .btnLeft', }, on: { init: function() { img_(0) }, slideChangeTransitionEnd: function() { let index = this.realIndex; $(".proTabBy-li").eq(index).fadeIn(); $(".proTabBy-li").eq(index).siblings(".proTabBy-li").hide(); img_(index) }, }, }); $('.proTab .proTab-nav .spanl').click(function(){ proTabnav.slidePrev(); }) $('.proTab .proTab-nav .spanr').click(function(){ proTabnav.slideNext(); }) } }) var prourl = window.location.href; var prostr = prourl.substr(0); prostr = prostr.split("#"); prostr=prostr[1]; var newprostr=prostr; if(prostr!=undefined){ prostr=prostr.substring(0,prostr.length-1) if(prostr=="wsd"){ newprostr=newprostr.charAt(newprostr.length-1); newprostr=newprostr-1; let slideLength=$(".proTab-nav .swiper-slide").length; if(slideLength>2){ proTabnav.slideToLoop(newprostr, 100, false); img_(newprostr); $(".proTabBy-li").eq(newprostr).fadeIn(); $(".proTabBy-li").eq(newprostr).siblings(".proTabBy-li").hide(); $('.threeNav-li').click(function(){ let lpkindex=$(this).index(); proTabnav.slideToLoop(lpkindex, 100, false); img_(lpkindex); $(".proTabBy-li").eq(lpkindex).fadeIn(); $(".proTabBy-li").eq(lpkindex).siblings(".proTabBy-li").hide(); }) }else{ $(".centers .swiper-slide").eq(newprostr).addClass("swiper-slide-active").siblings(".swiper-slide").removeClass("swiper-slide-active"); $(".proTabBy-li").eq(newprostr).fadeIn(); $(".proTabBy-li").eq(newprostr).siblings(".proTabBy-li").hide(); $('.threeNav-li').click(function(){ let lpkindex=$(this).index(); $(".centers .swiper-slide").eq(lpkindex).addClass("swiper-slide-active").siblings(".swiper-slide").removeClass("swiper-slide-active"); $(".proTabBy-li").eq(lpkindex).fadeIn(); $(".proTabBy-li").eq(lpkindex).siblings(".proTabBy-li").hide(); }) } } } function img_(thisin){ let imgsrc= $(".proTabBody .proTabBy-li").eq(thisin).find('.proTabImg img').attr('src'); $('.sz_pro_box .box .img_box .img_ img').attr('src',imgsrc); let textsrc=$(".proTabBody .proTabBy-li").eq(thisin).find('.proTabImg img').attr('data-tit'); $('.sz_pro_box .box .img_box .img_ p span').text(textsrc); } windowWidth(); $(".proTabKexuan").each(function(){ if($(this).find(".swiper-slide").length>3){ $(this).find('.btn_button').addClass('act'); } }) if($(window).width()>680){ proTabKexuans(); } }) $(window).resize(function(){ windowWidth(); if($(window).width()>680){ proTabKexuans(); } }) function proTabKexuans(){ var proTabKexuanSwp = []; $(".proTabBody").each(function(){ var _this = $(this); var _thisChild = _this.find(".proTabBy-li"); var _thisSize = _thisChild.length; _thisChild.each(function(){ $(this).find('.proTabKexuan').addClass('proTabKexuan' + $(this).index()); }) for(var z=0; z<_thisSize; z++){ proTabKexuanSwp[z] = new Swiper('.proTabKexuan'+z+' .proTabKexuanSwp', { slidesPerView: 2, spaceBetween: 0, centeredSlides: false, loop: false, speed: 800, breakpoints: { 680: { slidesPerView: 3, } }, autoplay: { delay: 5000, disableOnInteraction: false, }, navigation: { nextEl: '.proTabKexuan'+z+' .btnRight', prevEl: '.proTabKexuan'+z+' .btnLeft', }, observer: true, observeParents: true, centerInsufficientSlides: true, }); } }) } function windowWidth(){ if($(window).width()<680){ var tuijianNew = new Swiper('.tuijianNew', { slidesPerView: 2, spaceBetween: 15, centeredSlides: false, loop: false, speed: 800, pagination: { el: '.contactPage', clickable: true, }, observer: true, observeParents: true }); } } var contactSwp = new Swiper('.contactSwp', { slidesPerView: 3, spaceBetween: 45, // loop: true, speed: 800, observer: true, observeParents: true, breakpoints: { 320: { slidesPerView: 1, spaceBetween: 0, }, 768: { slidesPerView: 3, spaceBetween: 25, }, 1280: { slidesPerView: 3, spaceBetween: 45, }, }, navigation: { nextEl: '.contactMap .swpPvnt .swiper-nt', prevEl: '.contactMap .swpPvnt .swiper-pv', }, }); function tabsSwiper(menu, con, allowTouchMove) { var swiper = new Swiper(con, { speed: 500, spaceBetween: 10, autoHeight: true, allowTouchMove: !allowTouchMove, on: { slideChangeTransitionStart: function () { $(menu).find('li').eq(this.activeIndex).addClass('on').siblings().removeClass('on'); } } }); $(menu).on('click', 'li', function (e) { $(this).addClass('on').siblings().removeClass('on'); swiper.slideTo($(this).index()); }); }