// banner自适应高度 console.log("浏览器分辨率是" + document.documentElement.clientWidth + "*" + document.documentElement.clientHeight); console.log("屏幕分辨率是" + window.screen.width + "*" + window.screen.height); let isPc = true; let isPad = false; let isPhone = false; checkSize() $(window).resize(function () { checkSize() }); 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; isPhone = false; console.log("isPad", isPad); } else if (windowsWidth < 768) { isPc = false; isPad = false; isPhone = true; console.log("isPhone", isPhone); } console.log("windowsWidth", windowsWidth); } var mybanner = new Swiper('#sw_banner', { loop: true, speed: 500, autoplay: { disableOnInteraction: false, delay: 3000 }, navigation: { nextEl: '.swiper-button-next-banner', prevEl: '.swiper-button-prev-banner', }, pagination: { el: '.swiper-pagination-banner', clickable: true, }, on: { init: function (item) { bannerReSize() } } }) // 内页banner var sw_pagebanner = new Swiper ('#sw_pagebanner', { // loop:true, speed:300, on:{ init:function (item) { bannerReSize(item) } } }) 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":"cover","height":pcHeight + "px"}) $(".sw_banner .swiper-slide div").css({"height":pcHeight + "px"}) } if (isPad) { $(".sw_banner .swiper-slide").css({ "background-size": "cover", "height": padHeight + "px" }) $(".sw_banner .swiper-slide div").css({ "height": padHeight + "px" }) } if (isPhone) { $(".sw_banner .swiper-slide").css({ "background-size": "cover", "height": phoneHeight + "px" }) $(".sw_banner .swiper-slide div").css({ "height": phoneHeight + "px" }) } } $(window).resize(function () { bannerReSize() console.log("bannerUpdata"); }); // 视频按比例大小(iframe要加100%) $('.tab-content iframe').css('height', $('.tab-content iframe').width() * 0.56) // 产品 var swiperProduct = new Swiper('.product1-container', { autoplay: { delay: 6000, stopOnLastSlide: false, disableOnInteraction: false, }, navigation: { nextEl: '.product-button-next', prevEl: '.product-button-prev', }, noSwiping: true, noSwipingClass: 'stop-swiping', // slidesPerColumn: 2, // slidesPerColumnFill: 'row', slidesPerView: 4, spaceBetween: 28, breakpoints: { 1024: { slidesPerView: 4, spaceBetween: 28, }, 768: { slidesPerView: 3, spaceBetween: 28 }, 640: { slidesPerView: 2, spaceBetween: 28, } , 320: { slidesPerView: 2, spaceBetween: 28, } } }); // 新闻 var swiperNews = new Swiper('.news-container', { noSwiping: true, noSwipingClass: 'stop-swiping', // slidesPerColumn: 2, // slidesPerColumnFill: 'row', slidesPerView: 3, spaceBetween: 28, breakpoints: { 1024: { slidesPerView: 3, spaceBetween: 28, }, 768: { slidesPerView: 3, spaceBetween: 28, }, 640: { slidesPerView: 1, spaceBetween: 28, slidesPerColumn: 3, slidesPerColumnFill: 'row', } , 320: { slidesPerView: 1, spaceBetween: 28, slidesPerColumn: 3, slidesPerColumnFill: 'row', } } }); // 案例 var swiperCase = new Swiper('.case-container', { autoplay: { delay: 6000, stopOnLastSlide: false, disableOnInteraction: false, }, noSwiping: true, noSwipingClass: 'stop-swiping', slidesPerColumn: 3, slidesPerColumnFill: 'row', slidesPerView: 3, spaceBetween: 28, breakpoints: { 1024: { slidesPerView: 3, spaceBetween: 28, }, 768: { slidesPerView: 2, spaceBetween: 28, }, 640: { slidesPerView: 2, spaceBetween: 28, } , 320: { slidesPerView: 2, spaceBetween: 28, } } }); // 案例点击 $(document).ready(function(){ $(".scc-category-group-list").click(function(e){ $('.scc-category-group-list').removeClass('action') var targer_index = $(this)[0].dataset.index; $('.index_case_nav_' + targer_index).addClass('action'); console.log('scc-category-group-list',this,e,e.target.dataset['index']); console.log($(this)); }); }); // 证书 var swiperHonor = new Swiper('.honor-container', { autoplay: { delay: 6000, stopOnLastSlide: false, disableOnInteraction: false, }, pagination: { el: '.sac1-honor-pagination', clickable: true, }, noSwiping: true, noSwipingClass: 'stop-swiping', slidesPerView: 3, spaceBetween: 14, breakpoints: { 1024: { slidesPerView: 3, spaceBetween: 14, }, 768: { slidesPerView: 2, spaceBetween: 14, }, 640: { slidesPerView: 2, spaceBetween: 14, } , 320: { slidesPerView: 2, spaceBetween: 14, } } });