"use strict"; (function () { let pageVar = $("meta[name='generator']")[0].dataset.var; pageVar = pageVar.split("|"); pageVar = { pageUrl: pageVar[0], acode: pageVar[1], template: pageVar[2], tcode: pageVar[3], pcode: pageVar[4], scode: pageVar[5], }; let isPc = true; let isPad = false; let isPhone = false; function checkSize() { let windowsWidth = document.documentElement.clientWidth; if (windowsWidth > 991) { isPc = true; isPad = false; isPhone = false; console.log("isPc", isPc); } else if (windowsWidth >= 768 && windowsWidth <= 991) { isPc = false; isPad = true; console.log("isPad", isPad); } else if (windowsWidth < 768) { isPc = false; isPad = false; isPhone = true; console.log("isPhone", isPhone); } console.log("windowsWidth", windowsWidth); } checkSize(); document.querySelectorAll(".index_product3_sw_text2").forEach((item,index)=>{ if(index >= 4){ item.style.color = "#fff" } }) function bannerReSize(e) { // console.log(e); let pcHeight = $(".sw_banner")[0].dataset.pcheight; let padHeight = $(".sw_banner")[0].dataset.padheight; let phoneHeight = $(".sw_banner")[0].dataset.phoneheight; if (isPc) { $(".sw_banner .swiper-slide").css({ "background-size": "auto " + pcHeight + "px", "height": pcHeight + "px" }) $(".sw_banner").css({ "height": pcHeight + "px" }) $(".sw_banner .swiper-wrapper").css({ "height": pcHeight + "px" }) $(".sw_banner .swiper-slide div").css({ "height": pcHeight + "px" }) $(".sw_banner .swiper-slide div").css({ "height": pcHeight + "px" }) } if (isPad) { $(".sw_banner .swiper-slide").css({ "background-size": "auto " + padHeight + "px", "height": padHeight + "px" }) $(".sw_banner").css({ "height": padHeight + "px" }) $(".sw_banner .swiper-slide").css({ "height": padHeight + "px" }) $(".sw_banner .swiper-wrapper").css({ "height": padHeight + "px" }) $(".sw_banner .swiper-slide div").css({ "height": padHeight + "px" }) } if (isPhone) { $(".sw_banner .swiper-slide").css({ "background-size": "auto " + phoneHeight + "px", "height": phoneHeight + "px" }) $(".sw_banner").css({ "height": phoneHeight + "px" }) $(".sw_banner .swiper-wrapper").css({ "height": phoneHeight + "px" }) $(".sw_banner .swiper-slide").css({ "height": phoneHeight + "px" }) $(".sw_banner .swiper-slide div").css({ "height": phoneHeight + "px" }) } } var mybanner = new Swiper('#sw_banner', { loop: true, speed: 300, autoplay: { disableOnInteraction: false, delay: 4000 }, navigation: { nextEl: '.swiper-button-next-banner', prevEl: '.swiper-button-prev-banner', }, pagination: { el: '.swiper-pagination-banner', clickable: true, }, effect: "creative", creativeEffect: { prev: { shadow: true, origin: "left center", translate: ["-5%", 0, -200], rotate: [0, 100, 0], }, next: { origin: "right center", translate: ["5%", 0, -200], rotate: [0, -100, 0], }, }, on: { init: function (item) { bannerReSize() } } }) var sw_pagebanner = new Swiper('#sw_pagebanner', { loop: true, speed: 300, on: { init: function (item) { bannerReSize(item) } } }) //产品1 var index_product1_sw = new Swiper('#index_product1_sw', { autoplay: true, autoplay: { disableOnInteraction: false, }, watchSlidesVisibility: true, slidesPerView: 4, grid: { fill: 'row', rows: 2, }, spaceBetween: 20, breakpoints: { 1024: { slidesPerView: 4, }, 768: { slidesPerView: 3, }, 640: { slidesPerView: 2, }, 320: { slidesPerView: 2, } } }) //产品1 //产品2 var mySwiper_product2 = new Swiper('#index_product2_sw', { autoplay: true, autoplay: { disableOnInteraction: false, }, watchSlidesVisibility: true, slidesPerView: 4, spaceBetween: 20, breakpoints: { 1024: { slidesPerView: 4, }, 768: { slidesPerView: 3, }, 640: { slidesPerView: 2, }, 320: { slidesPerView: 2, } }, navigation: { nextEl: '.swiper_button_next_product', prevEl: '.swiper_button_prev_product', }, }) //产品2 //产品3 var index_product3_sw_text = new Swiper('#index_product3_sw_text', { slidesPerView: 4, watchSlidesVisibility: true, centerInsufficientSlides: true, breakpoints: { 1024: { slidesPerView: 4, }, 768: { slidesPerView: 4, }, 640: { slidesPerView: 2, }, 320: { slidesPerView: 2, } }, }) var mySwiper_product2 = new Swiper('.index_product3_sw_item', { autoplay: true, autoplay: { disableOnInteraction: false, }, watchSlidesVisibility: true, slidesPerView: 4, grid: { fill: 'row', rows: 2, }, spaceBetween: 20, breakpoints: { 1024: { slidesPerView: 4, }, 768: { slidesPerView: 3, }, 640: { slidesPerView: 2, }, 320: { slidesPerView: 2, } }, on: { init: function () { $('.index_product3_sw_text1').removeClass('active') $('.index_product3_sw_text1_' + this.activeIndex).addClass('active'); }, slideChangeTransitionEnd: function () { $('.index_product3_sw_text1').removeClass('active') $('.index_product3_sw_text1_' + this.activeIndex).addClass('active'); }, }, }) // $('.index_product3_sw_text1').hover(function (e) { // // console.log('index_product3_sw_text1',this,e,e.target.dataset['index']); // // console.log('index_product3_sw_text1',$(this).attr("data-index")); // $('.index_product3_sw_text1').removeClass('action') // var targer_index = $(this).attr("data-index"); // mySwiper_product2.slideTo(targer_index, 1000, false); // $('.index_product3_sw_text1_' + targer_index).addClass('action'); // }) //产品3 // 新闻 var index_msg1_sw_item = new Swiper('#index_msg1_sw', { spaceBetween: 10, on: { slideChangeTransitionEnd: function () { let indexSwiper = this.activeIndex; $('#index_msg1_sw_text .index_news1_text1').removeClass('action'); $('#index_msg1_sw_text .index_news1_text1_' + indexSwiper).addClass('action'); }, }, }) $('#index_msg1_sw_text .index_news1_text1').hover(function (e) { // console.log('index_product3_sw_text1',this,e,e.target.dataset['index']); // console.log('index_product3_sw_text1',$(this).attr("data-index")); $('#index_msg1_sw_text .index_news1_text1').removeClass('action') var targer_index = $(this).attr("data-index"); index_msg1_sw_item.slideTo(targer_index, 1000, false); $('#index_msg1_sw_text .index_news1_text1_' + targer_index).addClass('action'); }) // 新闻 // 设置视频 iframe比例 $('.clearfix iframe').css('height', $('.clearfix iframe').width() * 0.56) $('.clearfix video').css('height', $('.clearfix video').width() * 0.56) // 表格设置最大宽度 if (isPhone) { $('.clearfix table').wrapAll('
'); $('.clearfix td').removeAttr('width') } $(window).resize(function () { bannerReSize() console.log("bannerUpdata"); }); new WOW().init(); // 数字滚动 // $('.counter').countUp(); }());