$(function() { // 动画 if (!(/msie [6|7|8|9]/i.test(navigator.userAgent))) { new WOW().init(); }; // 移动端导航 let isOpenNav = false; $('.menu-mo').click(function() { if (isOpenNav) { isOpenNav = false; $(".nav-list").css({ "right": "-100%" }) } else { isOpenNav = true; $(".nav-list").css({ "right": "0" }) } }) // 列表2 - 左侧tab固定 const offsets = $('.suspension-tab').offset(); if (offsets) { const navH = offsets.top; $(window).scroll(function() { const scroH = $(this).scrollTop(); if (scroH >= navH) { $(".suspension-tab").css({ "position": "fixed", "left": "20px", "top": "20px" }); } else if (scroH < navH) { $(".suspension-tab").css({ "position": "absolute", "left": "20px", "top": "80px" }) } }) } // 首页banner const headHeight = $('.in-header').height(); const bannerHeight = $('.in-banner').height(); $('.in-banner .tops').click(function() { $('html,body').animate({ scrollTop: headHeight + bannerHeight + 'px' }, 800); }) var w=$(window).width(); var actions='vertical'; if (w<1280){ actions='left'; var swiperBanner = new Swiper(".in-banner-Swiper", { autoplay: true, pagination: { el: ".swiper-pagination", clickable: true, }, }); }else{ var swiperBanner = new Swiper(".in-banner-Swiper", { direction: actions, autoplay: true, pagination: { el: ".swiper-pagination", clickable: true, }, }); } // 首页印刷服务 $(".in-m2 .list .item").hover(function(){ const index= $(this).index(); $(".in-m2 .list .item").removeClass('active'); $(".in-m2 .serve-info").removeClass('serve-info-show'); $(this).addClass('active'); $(".in-m2 .serve-info").eq(index).addClass('serve-info-show'); }); // 首页新闻 var swiperTab = new Swiper(".in-m8-tab", { spaceBetween: 10, slidesPerView: 3, freeMode: true, watchSlidesProgress: true, }); var swipers = new Swiper(".in-m8-swiper", { spaceBetween: 10, autoplay: true, navigation: { nextEl: ".swiper-button-next", prevEl: ".swiper-button-prev", }, thumbs: { swiper: swiperTab, }, }); // 首页手风琴 let accordionIndex = 0; let m6Index = $(".in-m6-item"); let totals = m6Index.length - 1; $('.in-m6-next').click(function() { accordionOps(1); }) $('.in-m6-pre').click(function() { accordionOps(2); }) setInterval(() => { accordionOps(1); }, 3000) function accordionOps(type) { if (type === 1) { if (accordionIndex >= totals) { accordionIndex = 0; } else { accordionIndex++; }; } else { if (accordionIndex <= 0) { accordionIndex = totals; } else { accordionIndex--; }; } m6Index.removeClass("active"); m6Index.eq(accordionIndex).addClass("active"); } // 悬浮 $(window).scroll(function() { if ($(window).scrollTop() >= 300) { $(".in-suspension").stop(true, false).css("right", "0%"); } else { $(".in-suspension").stop(true, false).css("right", "-100px"); } }); $('.in-suspension .top').click(function() { $('html,body').animate({ scrollTop: '0px' }, 800); }) })