import * as utils from './lib/utils.js?v=1'; import './components/TabChange.js'; import './plugin/SmoothScroll.min.js'; import './plugin/jquery.share.min.js'; import './components/ShareIcon.js'; if (SmoothScroll) SmoothScroll({ stepSize: 100, animationTime: 600 }); $(() => { utils.countUp(); utils.imgDraggable(); utils.toTop(); utils.scrollX(); utils.gsapAni(); // $('.j-share').share({ sites: ['wechat', 'weibo', 'qq'] }); }); (() => { const header = $('header'); const openBtn = header.find('.open-btn'); const nav = header.find('nav'); const openBox = header.find('.open-box'); const navFade = gsap.fromTo( 'header nav', { opacity: 0, }, { opacity: 1, duration: 1, } ); function openNav() { header.addClass('open'); openBtn .find('.fa') .removeClass(openBtn.attr('data-normal')) .addClass(openBtn.attr('data-active')); if (utils.WINDTH > 890) { navFade.restart(); } } function closeNav() { header.removeClass('open'); openBtn .find('.fa') .removeClass(openBtn.attr('data-active')) .addClass(openBtn.attr('data-normal')); if (utils.WINDTH > 890) { navFade.restart(); } } function toggleNav() { if (header.hasClass('open')) { closeNav(); } else { openNav(); } } openBtn.click(() => toggleNav()); if (utils.WINDTH > 980) { nav.find('dl').click(() => { closeNav(); }); // header.hover( // () => { // openNav(); // }, // () => { // closeNav(); // } // ); utils.handleScroll({ scroll(st) { if (st > 200) { header.addClass('on'); } else { header.removeClass('on'); } }, }); } else { header.addClass('on'); } })(); (() => { const h1 = $('.ban-h1'); /** @type {String[]} */ const text = h1.text().split(''); h1.html(() => { return text.map((e) => `${e}`); }); })(); utils.setSwiper('.yf2 .swiper', { // autoplay: true, slidesPerView: 4, spaceBetween: 45, navigation: { prevEl: '.yf2 .swiper-btn.prev', nextEl: '.yf2 .swiper-btn.next', }, pagination: { el: '.yf2 .swiper-dots', }, mobile: { slidesPerView: 1, }, }); utils.setSwiper('.yf3 .books .swiper', { slidesPerView: 'auto', spaceBetween: 10, }); utils.setSwiper('.nc1 .swiper', { autoplay: true, spaceBetween: 28, slidesPerView: 4, navigation: { prevEl: '.nc1 .swiper-btn.prev', nextEl: '.nc1 .swiper-btn.next', }, pagination: { el: '.nc1 .swiper-dots', }, breakpoints: { 1024: { slidesPerView: 2, }, 1366: { slidesPerView: 3, }, 1650: { slidesPerView: 4, }, }, mobile: { slidesPerView: 1, }, }); (() => { const tabs = $('.qyry .tabs .tab'); const box = $('.qyry tab-change.box'); tabs.on('click', function () { const index = $(this).index(); $(this).addClass('on').siblings().removeClass('on'); box[0].dataset.show = index; }); })(); utils.setSwiper('.zz2 .swiper-box .swiper', { slidesPerView: 'auto', spaceBetween: 70, navigation: { prevEl: '.zz2 .swiper-btn.prev', nextEl: '.zz2 .swiper-btn.next', }, mobile: { spaceBetween: 40, }, }); utils.setSwiper('.i-banner .swiper', { delay: 3000, autoplay: { delay: 3000, disableOnInteraction: true, }, effect: 'fade', navigation: { nextEl: '.i-banner .swiper-btn.next', prevEl: '.i-banner .swiper-btn.prev', }, on: { init() { const consolebox = $('.i-banner .swiper-console'); consolebox.hover( () => { this.autoplay.stop(); }, () => { this.autoplay.start(); } ); }, }, }); utils.setSwiper('.i4 .swiper', { slidesPerView: 4, spaceBetween: 40, navigation: { prevEl: '.i4 .swiper-btn.prev', nextEl: '.i4 .swiper-btn.next', }, pagination: { el: '.i4 .swiper-dots', }, mobile: { slidesPerView: 1, }, }); // 工业物联网 (() => { utils.setSwiper('.z_sl_honor', { autoplay: true, slidesPerView: 2, spaceBetween: 60, grid: { fill: 'row', rows: 2, }, mobile: { spaceBetween: 20, }, }); $('.z_box_list .item').hover(function () { $(this).addClass('active').siblings().removeClass('active'); }); })(); const as = utils.setSwiper('.auto-swiper', { autoplay: true, slidesPerView: 'auto', on: { init() { if (this.el.classList.contains('only-pc')) { if (innerWidth < 980) { this.disable(); } } }, }, });