define("/Assets/enp/2022/js/module/e-module-202302151349.js", function (s, pub) { // 获取对象 var resourceObj = $('.e-module-202302151349'); var winW = $(window).width() // 判断页面有没有板块 if (resourceObj && resourceObj.length > 0) { resourceObj.each(function () { var _this = $(this); var winW = $(window).width(); objConList = _this.find('.worldwide').eq(0); h2W = _this.find('.e-title-h2 p').width(); h2Left = _this.find('.e-title-h2').offset().left; swiperLength = objConList.find('.swiper-slide').length; // 每次滚动的数量 var slidesPerGroup = 4; var slidesPerView = 4; if (swiperLength <= slidesPerView) { _this.find('.swiper-button').css("display", "none") } if (winW > 900) { slidesPerGroup = 4; slidesPerView = 4; _this.find('.swiper-slide').height(_this.find('.swiper-wrapper').height()) } else { slidesPerGroup = 1; slidesPerView = 1; } // 初始化con 轮播器功能 swiperList(_this); function swiperList(objConList) { // 判断当前下面con是否是否有轮播,数量是否超过1个 if (objConList.find('.swiper-slide').length > 4 && winW > 900) { // 防止swiper重复调用。判断objConList.data('init')是否已经存在 if (objConList.data('init') == undefined) { // 第一次调用swiper后,禁止再次调用 objConList.data('init', 'true'); var slideLength = objConList.find(".swiper-slide").length; var mySwiper = new Swiper(objConList.find(".swiper"), { slidesPerView: slidesPerView, spaceBetween: 0, resistanceRatiao: 1, //触底不反弹 watchOverflow: true, //一屏显示左右按钮和pag centeredSlides: false, slidesPerGroup: slidesPerGroup, pagination: { el: objConList.find('.swiper-pagination'), clickable: true, }, autoplay: _this.data("auto-time") ? { delay: _this.data("auto-time"), stopOnLastSlide: false, disableOnInteraction: true } : false, noSwiping: slideLength > slidesPerGroup ? false : true, navigation: { nextEl: objConList.find('.icon-right'), prevEl: objConList.find('.icon-left') }, on: { init: function () { objConList.find(".swiper-slide").each(function () { var imgObj = $(this).find(".swiper-cons .e-lazy img"); imgObj.attr("src", imgObj.data("original")); }) if (winW > 1200) { var swiperBgObj = _this.find('.swiper-bg'); var num = parseInt(swiperBgObj.css('padding-top')) + parseInt(swiperBgObj.css('padding-bottom')); _this.find('.swiper-bg').height(_this.find('.e-lazy').height() - num + 70); } }, } }); mySwiper.on('slideChangeTransitionEnd', function () { if (winW > 1200) { var index = mySwiper.realIndex; index += 1; objConList.find('.slideCur').text('0' + index); } }) //鼠标覆盖停止自动切换 mySwiper.el.onmouseover = function () { mySwiper.autoplay.stop(); } //鼠标离开开始自动切换 mySwiper.el.onmouseout = function () { mySwiper.autoplay.start(); } } } else { objConList.find('.swiper-pagination').css({ 'display': 'none' }); objConList.find('.swiper-btn').css({ 'display': 'none' }); if (winW > 1200) { var swiperBgObj = objConList.find('.swiper-bg'); var num = parseInt(swiperBgObj.css('padding-top')) + parseInt(swiperBgObj.css('padding-bottom')); _this.find('.swiper-bg').height(_this.find('.e-lazy').height() - num + 70); } } } if (winW < 1200) { // 计算文字区域高度 var maxH = 0; var h3H = 0; _this.find(".ptxt2").each(function () { var itemH = $(this).height(); if (itemH > maxH) { maxH = itemH; } }); _this.find(".swiper-bg h3").each(function () { var itemH = $(this).height(); if (itemH > h3H) { h3H = itemH; } }); _this.find(".ptxt2").height(maxH); _this.find(".swiper-bg h3").height(h3H); } }) } });