$require(['swiper'], function () { var man_banner = new Swiper('.man_banner', { autoplay:true, loop: true, effect: 'fade', speed: 800, navigation: { nextEl: '.man_banner_04 .p_btn_next', prevEl: '.man_banner_04 .p_btn_prev', }, pagination: { el: '.man_banner_04 .p_pagenation', clickable: true, renderBullet: function (index, className) { return ''; }, }, on: { init: function (swiper) { $('.p_pagenation_i').attr('dot-active', '1') }, slideChangeTransitionStart: function (swiper) { let dotactive = $('.swiper-pagination-bullet-active').index(); $('.p_pagenation_i').attr('dot-active', dotactive + 1) var bulletActive = document.querySelector('.swiper-pagination-bullet-active'); var pagenationI = document.querySelector('.p_pagenation_i'); var pagenationIStyle = pagenationI.style; if (bulletActive) { var offsetLeft = bulletActive.offsetLeft; var width = bulletActive.offsetWidth; var offsetWidthI = pagenationI.offsetWidth; pagenationIStyle.left = `calc(${offsetLeft}px - (${offsetWidthI}px / 2) + (${width}px / 2))`; } else { console.log('未找到具有类名 ".swiper-pagination-bullet-active" 的元素'); pagenationIStyle.left = '0'; } gsap.to(".circle", { delay: 0, duration: 1, scale: 4, ease: "ease" }) }, slideChangeTransitionEnd: function () { gsap.to(".circle", { delay: 0.2, duration: 1, scale: 0.9, ease: "elastic.out(0.6, 0.55)" }) }, }, }); // 文字 var manBannerText = new Swiper('.manBannerText', { loop: true, speed: 800, controller: { control: man_banner, }, }); man_banner.controller.control = manBannerText; manBannerText.controller.control = man_banner; })