define("/Assets/enp/v2/js/ebg-module/ebg-module-quotes-one.js", ["/Assets/enp/v2/js/vendor/swiper-5.3.6.min.js"], function (s, pub) { // 判断有没有模块 if ($('.ebg-module-quotes-one').length > 0) { // 遍历每个模块 $('.ebg-module-quotes-one').each(function () { // 获取对象 var This = $(this); var objUl = This.find('.ebg-tab .head') var objLi = This.find('.ebg-tab .head .tab-menus ul li'); var objLiLength = objLi.length; // 获取最外层元素的背景颜色。如果是白色就默认。如果是#f8f8f8就把下面轮播器的遮罩改成#f8f8f8。 if (This.css('backgroundColor') == 'rgb(248, 248, 248)') { This.find('.ebg-con .ebg-tab').addClass('f8f8f8'); } // 判断head有没有tab切换 if (objLiLength > 1) { // 显示tab This.find('.ebg-tab .head').css('display', 'block'); // tab点击事件。点击tab切换下面内容 objLi.on('click', function () { // 获取head对象 var _this = $(this); // 获取下标 var _index = _this.index(); // 获取con对象。objConList对象就是对应的list var objConList = This.find('.ebg-tab .con .list').eq(_index); // 添加高亮class _this.addClass('active').siblings().removeClass('active'); // 隐藏显示 objConList.show().siblings().hide(); // 初始化con 轮播器功能 conListNewSwiper(objConList); }); // 初始化手动触发事件 objLi.eq(0).trigger('click'); // 判断所有li加起来总长度是否超出objUlW的width var objLiW = 0; var objUlW = objUl.width(); objLi.each(function () { objLiW += $(this).outerWidth() + 10; }) // 如果超过ul的长度,就new swiper。示左右轮播器 if (objLiW > objUlW) { $(objUl.find('.ulW').addClass('initSwiper')) $(objUl.find('.ebg-tab-head-item').addClass('initHeadItem')) // 显示左右箭头 objUl.find('.nav-btn').css('display', 'block'); // 显示左右轮播器 var objLiSwiper = new Swiper(objUl.find('.tab-menus'), { loop: false, slidesPerView: 'auto', roundLengths: false, freeMode: false, watchOverflow: true, // spaceBetween: 10, roundLengths: true, freeModeMomentum: false, resistanceRatiao: 0, //触底不反弹 wrapperClass: "ebg-module-quotes-one .tab-menus ul.initSwiper", slideClass: 'ebg-module-quotes-one .ebg-tab-head-item.initHeadItem', navigation: { nextEl: objUl.find('.button-next'), prevEl: objUl.find('.button-prev'), } }) } else { objUl.find('.ulW').css("justify-content", "center") } } else { // 获取con对象。 objConList对象就是对应的list var objConList = This.find('.ebg-tab .con .list').eq(0); // 初始化con 轮播器功能 conListNewSwiper(objConList); } function conListNewSwiper(objConList) { // 判断当前下面con是否是否有轮播,数量是否超过1个 if (objConList.find('.swiper-slide').length > 1) { // 防止swiper重复调用。判断objConList.data('init')是否已经存在 if (objConList.data('init') == undefined) { // 第一次调用swiper后,禁止再次调用 objConList.data('init', 'true'); new Swiper(objConList.find('.swiper-container'), { slidesPerView: 1.03, spaceBetween: 15, // loop: true, // autoplay: false, resistanceRatiao: 1, //触底不反弹 watchOverflow: true, //一屏显示左右按钮和pag centeredSlides: false, observer: true, observeParents: true, autoplayDisableOnInteraction: false, pagination: { el: objConList.find('.pagination'), type: 'fraction', }, navigation: { nextEl: objConList.find('.icon-right'), prevEl: objConList.find('.icon-left') }, breakpoints: { 750: { slidesPerView: 1, autoplay: false, spaceBetween: 30, resistanceRatiao: 1, //触底不反弹 watchOverflow: true, //一屏显示左右按钮和pag centeredSlides: false, observer: true, observeParents: true, autoplayDisableOnInteraction: false, } }, }); } } else { objConList.find('.navigation-con').css('display', 'none'); } } }) } });