// banner if ($('.e-module-202304171443').length > 0) { function module202304171443Fun($target) { var module202304171443Obj = { init: function () { // 获取属性 this.win = $(window); this.moduleObj = $target; this.bannerObj = $('.e-module-202304171443'); this.headerObj = $('.e-module-202209210900'); this.blackNavObj = $('.e-module-202208180950'); this.cookieObj = $('.e-module-202208270930'); this.breadObj = $('.e-module-202209051504') this.bannerWrapObj = this.bannerObj.find('.mySwiper2'); this.bannerSlideObj = this.bannerWrapObj.find(".swiper-slide"); this.moduleSlideObj = this.bannerObj.find(".mySwiper .swiper-slide"); // 调用函数 this.resizeInit(); // 需要rezise的变量 this.setBannerHeight(); // 设置banner高度,banner的高度是屏幕的高度减去顶部导航的高度 // 判断页面是一个banner还是多个,一个就不需要加载swiper插件。多个就加载 if (this.bannerSlideObj.length > 1) { if (this.bannerObj.data("swiper-init")) { return; } this.bannerObj.data("swiper-init", true); this.initSwiper(); } else { // 添加视频 } // for (var i = 0; i < this.bannerSlideObj.length; i++) { // this.addVideoLink(this.bannerSlideObj.eq(i).find('.e-bg')); // } // this.bannerSlideObj.each(function () { // this.addVideoLink($(this).find('.e-bg')); // }) this.lazyVideoLink(); // 视频是否加载 this.lazyPicLink(); // 视频是否图片 this.setVideoCenterShow(); // 视频居中显示 this.scrollEvent(); // 滚动条事件 this.clickEvent(); // 点击关闭顶部的cookie声明,重新计算banner高度 this.resizeEvent(); }, resizeInit: function () { this.winh = this.win.height(); this.winw = this.win.width(); this.headerObjH = this.headerObj.outerHeight(); this.blackNavObjH = this.blackNavObj.outerHeight(); this.breadObjH = this.breadObj.outerHeight(); // 获取位置 this.scrollTop = this.win.scrollTop(); this.moduleTop = this.bannerObj.offset().top; }, setBannerHeight: function () { if (this.cookieObj.css('display') == 'block') { // 这个下面的52是cookie的高度,因为获取这个高度需要等获取用户有没有登录或者是否同意这个cookie,所有认为只要是显示了block,我就认为他存在,直接写了一个cookie高度52。 var h = parseInt(this.winh - this.headerObjH - 52 - this.blackNavObjH - this.breadObjH); this.bannerObj.height(h); this.bannerWrapObj.css({ 'height': h, }); } else { // 如果cookie条关闭了,直接banner置顶,这样解决了页面往下滚动的时候,文字跳动的情况。 this.bannerObj.height(parseInt(this.winh - this.headerObjH - this.breadObjH)) var h = parseInt(this.winh - this.headerObjH - this.breadObjH) this.bannerWrapObj.css({ 'height': h, }); } }, setVideoCenterShow: function () { // 设计规则:视频尺寸比例必须是1920*1080 var videoObj = this.bannerObj.find('.video'); if ((this.bannerObj.height() / this.winw) > (1080 / 1920)) { // 视频就需要高度100%显示,左右裁切 videoObj.css({ width: 'auto', height: '100%' }) } else { videoObj.css({ width: '100%', height: 'auto' }) } }, lazyPicLink: function () { // 加载图片 if (this.scrollTop + this.winh * 1.5 > this.moduleTop) { // 当滚动条滚动到当前位置时,加载视频 this.addPicLink(); } }, lazyVideoLink: function () { // 加载视频 if (this.scrollTop + this.winh * 1.5 > this.moduleTop) { // 当滚动条滚动到当前位置时,加载视频 this.addVideoLink(); } }, addPicLink: function () { this.bannerSlideObj = this.bannerWrapObj.find(".swiper-slide"); this.bannerSlideObj.each(function () { var $this = $(this); var src = $this.find('img').attr("data-original"); if ($this.find(".e-bg").css("backgroundImage") != "url(" + src + ")") { $this.find(".e-bg").css("backgroundImage", "url('" + src + "')"); $this.find(".e-bg e-lazy").css("display", "none"); } }) }, addVideoLink: function () { if (this.winw > 1200) { this.moduleSlideObj = $target.find(".swiper-slide"); this.moduleSlideObj.each(function () { var $this = $(this); if ($this.find(".e-bg").data('src') != '' && $this.find('.video').length == 0) { // 添加video的dom结构 $this.find(".e-bg").append(""); // 判断视频是否已经赋值,如果赋值了,就不需要再次赋值了。 $this.find('.video').attr("src", $this.find(".e-bg").data('src')); } }) } else { $target.find('.video').remove(); } }, clickEvent: function () { var _this = this; _this.cookieObj.find('.close').on('click', function () { _this.bannerObj.height(parseInt(_this.winh - _this.headerObjH - _this.blackNavObjH - _this.breadObjH)) var h = parseInt(_this.winh - _this.headerObjH - _this.breadObjH) _this.bannerWrapObj.css({ 'height': h, }); }) }, scrollEvent: function () { var _this = this; this.win.on('scroll.202304171443', function () { }) }, initSwiper: function () { var _this = this; var $target = this.bannerObj; var slideLength = this.bannerSlideObj.length; var swiper = new Swiper(".mySwiper", { spaceBetween: 40, slidesPerView: 4, freeMode: true, watchSlidesProgress: true, breakpoints: { // 最小屏幕 1600: { slidesPerView: 4, spaceBetween: 40, }, 1200: { slidesPerView: 4, spaceBetween: 30, }, }, }); var swiper2 = new Swiper(".mySwiper2", { spaceBetween: 10, pagination: { el: $target.find('.swiper-pagination'), clickable: true, }, autoplay: ($target.data("auto-time") && _this.winw > 1200) ? { delay: $target.data("auto-time"), stopOnLastSlide: false, disableOnInteraction: true } : false, loop: (slideLength > 1 && _this.winw > 1200) ? true : false, // 设置自动轮播 effect: 'fade', thumbs: { swiper: swiper, }, }); this.moduleSlideObj.hover(function () { var _index = $(this).index(); swiper2.slideTo(_index + 1, 1000, false);//切换到第一个slide,速度为1秒 }, function () { swiper2.autoplay.start() }) }, resizeEvent: function () { // 页面resize事件 var _this = this; var resizeWinw = 0; var resizeTimer = ''; this.win.on('resize', function () { var winw = _this.win.width(); if (winw != resizeWinw) { currentWinw = winw; // 删除之前的定时器 if (resizeTimer) { clearTimeout(resizeTimer); } // 添加新的定时器 resizeTimer = setTimeout(function () { // 调用函数 _this.resizeInit(); // 需要rezise的变量 _this.setBannerHeight(); // 设置banner高度,banner的高度是屏幕的高度减去顶部导航的高度 // 判断页面是一个banner还是多个,一个就不需要加载swiper插件。多个就加载 // 添加视频 for (var i = 0; i < _this.bannerSlideObj.length; i++) { _this.addVideoLink(_this.bannerSlideObj.eq(i).find('.e-bg')); } // _this.addVideoLink(_this.bannerObj.find('.e-bg')); _this.setVideoCenterShow(); // 视频居中显示 _this.scrollEvent(); // 滚动条事件 _this.clickEvent(); // 点击关闭顶部的cookie声明,重新计算banner高度 }, 200) } }) } } module202304171443Obj.init(); } // 初始化 $('.e-module-202304171443').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202304171443Fun($(this)); }) } // 定位导航 if ($('.e-module-202304231342').length > 0) { function module202304231342Fun($target) { var module202304231342Obj = { init: function () { // 获取属性 this.win = $(window); this.moduleObj = $target; this.fixedBoxObj = this.moduleObj.find('.fixed-box'); this.liObj = this.moduleObj.find("li"); this.headObj = $('.e-module-202209210900 .header-new'); this.anchorPointObj = $('.anchorpoint'); this.perScrollTop = 0; this.scrollLock = false; //区分是鼠标滚动还是自动滚动 this.resizeInit(); this.highlightNav(); this.clickEvent(); this.scrollEvent(); this.mouseEvent(); this.anchor(); this.resizeEvent(); }, resizeInit: function () { this.winw = this.win.width(); this.winh = this.win.height(); // 获取位置 this.scrollTop = this.win.scrollTop(); this.moduleTop = this.moduleObj.offset().top; this.docH = $(document).height(); if (this.winw > 1200) { this.moduleObj.find('.anchor').show(); } else { this.moduleObj.find('.anchor').hide(); } }, anchor: function () { var queryStr = getQueryString("section"); if (queryStr == undefined) return // 清除滚动条默认位置 if ('scrollRestoration' in history) { history.scrollRestoration = 'manual'; } this.liObj.each(function () { var _this = $(this); if (_this.data('key') == queryStr) { setTimeout(function () { _this.trigger('click'); }, 500) } }) // 获取链接参数 function getQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); var r = window.location.search.substr(1).match(reg); if (r != null) return unescape(r[2]); } }, highlightNav: function () { var _this = this; // 高亮显示当前导航 var perLightHighIndex = -2; var anchorpointArr = []; _this.anchorPointObj.each(function () { //已经到达内容的一半的距离 anchorpointArr.push($(this).offset().top + $(this).height()); }) var anchorLen = anchorpointArr.length; for (var i = 0; i < anchorLen; i++) { if (_this.scrollTop <= anchorpointArr[i]) { //高亮发生改变 if (perLightHighIndex != i) { _this.liObj.eq(i).addClass('active').siblings().removeClass('active'); perLightHighIndex = i; _this.moduleObj.find('.wap-title').text(this.liObj.eq(i).text()); } break; } } // 滚动时移动端title显示当前板块 if (_this.winw < 1200) { var $titleObj = _this.moduleObj.find('.wap-title'); if (_this.liObj.eq(perLightHighIndex).text() != '') { $titleObj.text(_this.liObj.eq(perLightHighIndex).text()); } } }, mouseEvent: function () { $(".e-module-202304231342 .anchor").on("mousedown.202304231342", function (e) { var _this = $(".e-module-202304231342 .anchor"); var off = true; var curNum = 0; var scrollX = 0; $("body").on("mousemove.202304231342", function (e1) { var moveX = e1.clientX; // 判断是点击还是滚动,如果点击后鼠标滑动超过10px,我判断为鼠标滑动 if (off) { off = false; curNum = moveX; scrollX = _this.find('.sl').scrollLeft(); } //移动时的坐标减去落入时的坐标 var x = moveX - curNum; _this.find('.sl').scrollLeft(scrollX - x); }); //mouseup事件,关闭当前mousemove事件,并将定时置空 $("body").on("mouseup", function (e) { $("body").off("mousemove.202304231342"); }) }) }, clickEvent: function () { var _this = this; var clickiTime = 0; _this.liObj.on('click', function (e) { // 阻止时间冒泡 e.stopPropagation(); scrollLock = true; var li_index = $(this).index(); var head_h = _this.headObj.height(); var anchor_point_t = []; _this.anchorPointObj.each(function () { anchor_point_t.push($(this).offset().top - 70); }); var willScrollTop = anchor_point_t[li_index]; $("body,html").stop(true, true).animate({ "scrollTop": willScrollTop + 75 }); _this.headObj.clearQueue().animate({ 'top': -head_h }, 300, function () { // 高亮 _this.liObj.eq(li_index).addClass('active').siblings().removeClass('active'); var $titleObj = _this.moduleObj.find('.wap-title'); $titleObj.text(_this.liObj.eq(li_index).text()); clearTimeout(clickiTime); clickiTime = setTimeout(function () { _this.perScrollTop = _this.win.scrollTop(); scrollLock = false; }, 150) }); _this.fixedBoxObj.css({ 'position': 'fixed', }).clearQueue().animate({ 'top': 0 }, 300).parents('.e-module-202304231342').addClass('fixed'); // 移动端 if (_this.winw < 1200) { if (!_this.moduleObj.find('.anchor').is(':hidden')) { _this.moduleObj.find('.anchor').slideToggle(); } } if (_this.winw < 1200) { _this.moduleObj.find('.wap-line').toggleClass("wap-another"); } }) //移动端点击显示二级导航栏的标题,展开定位下拉 $('.e-module-202304231342 .wap-controller').on('click', function (e) { if (_this.winw < 1200) { // 阻止时间冒泡 e.stopPropagation(); $(this).nextAll('.anchor').slideToggle(); $(this).children('.wap-line').toggleClass("wap-another") } }) // 移动端点击body,如果定位导航展开,需要收起 $('body').on('click', function () { if (_this.winw < 1200) { if (!_this.moduleObj.find('.anchor').is(':hidden')) { _this.moduleObj.find('.anchor').slideToggle(); } } }) }, scrollEvent: function () { var _this = this; var timer = 0; _this.win.on('scroll.202304231342', function () { if (_this.scrollLock) { return } clearTimeout(timer); timer = setTimeout(function () { _this.scrollTop = _this.win.scrollTop(); var head_h = _this.headObj.height() + 1; var moduleTop = _this.moduleObj.offset().top - _this.moduleObj.height(); _this.docH = $(document).height(); var winh = _this.winh * 1.5; // 判断滚动条是往上还是往下滚动 if (_this.scrollTop - _this.perScrollTop >= 3) { //向下 // 判断滚动条滚动到什么位置 if (_this.scrollTop + head_h > moduleTop && _this.scrollTop < (_this.docH - winh)) { //顶部交界处 // 计算滚动条移动的位置 _this.headObj.clearQueue().animate({ 'top': -head_h }, 300); _this.fixedBoxObj.css({ 'position': 'fixed' }).clearQueue().animate({ 'top': 0 }, 300).parents('.e-module-202304231342').addClass('fixed'); } else if ((_this.docH - _this.scrollTop) <= winh) { //底部交界处 _this.headObj.clearQueue().animate({ 'top': 0 }, 300); _this.fixedBoxObj.css({ 'position': 'fixed', }).clearQueue().animate({ 'top': head_h }, 300).parents('.e-module-202304231342').addClass('fixed'); } } else if (_this.scrollTop - _this.perScrollTop <= -3) { //向上 // 判断滚动条滚动到什么位置 if (_this.scrollTop - head_h - _this.moduleObj.height() < moduleTop) { //顶部交界处 // 计算滚动条移动的位置 _this.headObj.clearQueue().animate({ 'top': 0 }, 300); _this.fixedBoxObj.stop(true).css({ 'position': 'absolute', 'top': '0px' }).parents('.e-module-202304231342').removeClass('fixed'); } else if ((_this.docH - _this.scrollTop) >= winh) { //底部交界处 _this.headObj.clearQueue().animate({ 'top': 0 }, 300); _this.fixedBoxObj.css({ 'position': 'fixed', }).clearQueue().animate({ 'top': head_h }, 300).parents('.e-module-202304231342').addClass('fixed'); } } _this.highlightNav(); _this.perScrollTop = _this.scrollTop; }, 0) }) }, resizeEvent: function () { // 页面resize事件 var _this = this; var resizeWinw = 0; var resizeTimer = ''; this.win.on('resize.202304231342', function () { var winw = _this.win.width(); if (winw != resizeWinw) { currentWinw = winw; // 删除之前的定时器 if (resizeTimer) { clearTimeout(resizeTimer); } // 添加新的定时器 resizeTimer = setTimeout(function () { _this.resizeInit(); }, 100) } }) } }; module202304231342Obj.init(); } // 初始化 $('.e-module-202304231342').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202304231342Fun($(this)); }) } // 新产品新方案 if ($('.e-module-202304131712').length > 0) { function module202304131712Fun($target) { var module202304131712Obj = { init: function () { // 获取属性 this.win = $(window); this.moduleObj = $target; this.moduleWrapperObj = this.moduleObj.find(".swiper-wrapper"); this.moduleSlideObj = this.moduleObj.find(".swiper-slide"); this.resizeInit(); // resize初始化 this.judgmentSwiper(); // 判断需不需要执行swiper this.scrollEvent(); // 设置滚动事件,文字动画效果 this.resizeEvent(); // 设置自适应 this.lazyPicLink(); // 是否加载图片 this.addHoverCon(); //hover添加内容 }, resizeInit: function () { this.winw = this.win.width(); this.winh = this.win.height(); // 获取位置 this.scrollTop = this.win.scrollTop(); this.moduleTop = this.moduleObj.offset().top; }, judgmentSwiper: function () { if (this.moduleSlideObj.length > 1) { if (this.moduleObj.data("swiper-init")) { return; } this.moduleObj.data("swiper-init", true); this.initSwiper(); } else if (this.moduleSlideObj.length == 1) { $target.find(".swiper-button").css({ "display": "none" }) } }, lazyPicLink: function () { // 加载图片 if (this.scrollTop + this.winh * 1.5 > this.moduleTop) { // 当滚动条滚动到当前位置时,加载视频 this.moduleSlideObj = this.moduleObj.find(".swiper-slide"); this.moduleSlideObj.each(function () { var $this = $(this); var imgObj = $this.find('img'); var src = imgObj.attr("data-original"); if (imgObj.attr("src") != src) { imgObj.attr("src", src) } }) } }, initSwiper: function () { var _this = this; // 每次滚动的数量 var slidesPerGroup = 1; var slideLength = $target.find(".swiper-slide").length; var mySwiper = new Swiper($target.find(".swiper"), { watchOverflow: true, // 一屏不显示左右箭头以及pagination spaceBetween: 21, // 板块与板块之间的间距 slidesPerView: 1, //每屏幕显示的个数 slidesPerGroup: slidesPerGroup, // 每次轮播的个数 // 如果需要前进后退按钮 navigation: { nextEl: $target.find('.swiper-button-next'), prevEl: $target.find('.swiper-button-prev'), }, // 如果需要分页器 pagination: { el: $target.find('.swiper-pagination'), clickable: true, }, grabCursor: slideLength > 1 ? true : false, autoplay: ($target.data("auto-time") && _this.winw > 1200) ? { delay: $target.data("auto-time"), stopOnLastSlide: false, disableOnInteraction: true } : false, loop: (slideLength > 1 && _this.winw > 1200) ? true : false, // 设置自动轮播 noSwiping: slideLength > 1 ? false : true, runCallbacksOnInit: true, // 触发一次回调函数 on: { init: function () { }, resize: function () { var This = this; setTimeout(function () { // This.emit('init'); This.update(); //窗口变化时,更新Swiper的一些属性,如宽高等 }, 150) }, } }); // 鼠标覆盖停止自动切换 mySwiper.el.onmouseover = function () { mySwiper.autoplay.stop(); } // 鼠标离开开始自动切换 mySwiper.el.onmouseout = function () { mySwiper.autoplay.start(); } }, scrollEvent: function () { var _this = this; _this.win.on('scroll.202304131712', function () { _this.lazyPicLink(); // 视频是否图片 }); }, addHoverCon: function () { var box = this.moduleObj.find(".row-inner .inner-item>.box"); box.each(function (index) { var hoverBox = '
' + $(this).find('.default-box').html() + '
'; $(this).find('.default-box').after(hoverBox); if ($(this).find('.hover_box img').data('xl') != '') { $(this).find('.hover_box img').attr('src', $(this).find('.hover_box img').data('xl')) } }) }, resizeEvent: function () { // 页面resize事件 var _this = this; var resizeWinw = 0; var resizeTimer = ''; this.win.on('resize.202304131712', function () { var winw = _this.win.width(); if (winw != resizeWinw) { currentWinw = winw; // 删除之前的定时器 if (resizeTimer) { clearTimeout(resizeTimer); } // 添加新的定时器 resizeTimer = setTimeout(function () { _this.resizeInit(); // resize初始化 _this.judgmentSwiper(); // 判断需不需要执行swiper _this.scrollEvent(); // 设置滚动事件,文字动画效果 }, 100) } }) } }; module202304131712Obj.init(); } // 初始化 $('.e-module-202304131712').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202304131712Fun($(this)); }) } // 新技术 if ($('.e-module-202304130950').length > 0) { function module202304130950Fun($target) { var module202304130950Obj = { init: function () { // 获取属性 this.win = $(window); this.moduleObj = $target; this.moduleWrapperObj = this.moduleObj.find(".swiper-wrapper"); this.moduleSlideObj = this.moduleObj.find(".swiper-slide"); this.resizeInit(); // resize初始化 this.judgmentSwiper(); // 判断需不需要执行swiper this.scrollEvent(); // 设置滚动事件,文字动画效果 this.resizeEvent(); // 设置自适应 this.lazyPicLink(); // 是否加载图片 this.addHoverCon(); //hover添加内容 }, resizeInit: function () { this.winw = this.win.width(); this.winh = this.win.height(); // 获取位置 this.scrollTop = this.win.scrollTop(); this.moduleTop = this.moduleObj.offset().top; }, judgmentSwiper: function () { if (this.moduleSlideObj.length > 1 && this.winw > 992) { if (this.moduleObj.data("swiper-init")) { return; } this.moduleObj.data("swiper-init", true); this.initSwiper(); } else if (this.moduleSlideObj.length == 1) { $target.find(".swiper-button").css({ "display": "none" }) } }, lazyPicLink: function () { // 加载图片 if (this.scrollTop + this.winh * 1.5 > this.moduleTop) { // 当滚动条滚动到当前位置时,加载视频 this.moduleSlideObj = this.moduleObj.find(".swiper-slide"); this.moduleSlideObj.each(function () { var $this = $(this); var imgObj = $this.find('img'); var src = imgObj.attr("data-original"); if (imgObj.attr("src") != src) { imgObj.attr("src", src) } }) } }, initSwiper: function () { var _this = this; // 每次滚动的数量 var slidesPerGroup = 1; if (_this.winw > 1200) { slidesPerGroup = 4; } else if (_this.winw > 750) { slidesPerGroup = 2; } var mySwiper = new Swiper($target.find(".swiper"), { watchOverflow: true, // 一屏不显示左右箭头以及pagination spaceBetween: 20, // 板块与板块之间的间距 slidesPerView: 1, //每屏幕显示的个数 slidesPerGroup: slidesPerGroup, // 每次轮播的个数 // 如果需要前进后退按钮 navigation: { nextEl: $target.find('.swiper-button-next'), prevEl: $target.find('.swiper-button-prev'), }, // 如果需要分页器 pagination: { el: $target.find('.swiper-pagination'), clickable: true, }, breakpoints: { // 最小屏幕 1200: { slidesPerView: 4, spaceBetween: 40, }, 992: { slidesPerView: 2, spaceBetween: 20, } }, on: { init: function () { if (_this.moduleSlideObj.length == 2) { _this.moduleSlideObj.addClass('sw-2') } }, resize: function () { var This = this; setTimeout(function () { // 不同屏幕下,轮播个数 if (_this.winw > 1200) { This.params.slidesPerGroup = 4; } else if (_this.winw > 750) { This.params.slidesPerGroup = 2; } else { This.params.slidesPerGroup = 1; } // This.emit('init'); This.update(); //窗口变化时,更新Swiper的一些属性,如宽高等 }, 150) }, } }); }, scrollEvent: function () { var _this = this; _this.win.on('scroll.202304130950', function () { _this.lazyPicLink(); // 视频是否图片 }); }, addHoverCon: function () { var box = this.moduleObj.find(".swiper-slide>.box"); box.each(function (index) { var hoverBox = '
' + $(this).find('.default-box').html() + '
'; $(this).find('.default-box').after(hoverBox) if ($(this).find('.hover_box img').data('xl') != '') { $(this).find('.hover_box img').attr('src', $(this).find('.hover_box img').data('xl')) } }) }, resizeEvent: function () { // 页面resize事件 var _this = this; var resizeWinw = 0; var resizeTimer = ''; this.win.on('resize.202304130950', function () { var winw = _this.win.width(); if (winw != resizeWinw) { currentWinw = winw; // 删除之前的定时器 if (resizeTimer) { clearTimeout(resizeTimer); } // 添加新的定时器 resizeTimer = setTimeout(function () { _this.resizeInit(); // resize初始化 _this.judgmentSwiper(); // 判断需不需要执行swiper _this.scrollEvent(); // 设置滚动事件,文字动画效果 }, 100) } }) } }; module202304130950Obj.init(); } // 初始化 $('.e-module-202304130950').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202304130950Fun($(this)); }) } // 新案例 if ($('.e-module-202304141421').length > 0) { function module202304141421Fun($target) { var module202304141421Obj = { init: function () { // 获取属性 this.win = $(window); this.moduleObj = $target; this.moduleWrapperObj = this.moduleObj.find(".swiper-wrapper"); this.moduleSlideObj = this.moduleObj.find(".swiper-slide"); this.moduleListObj = this.moduleObj.find(".bg-list"); this.moduleItemObj = this.moduleObj.find(".bg-item"); this.resizeInit(); // resize初始化 this.judgmentSwiper(); // 判断需不需要执行swiper this.scrollEvent(); // 设置滚动事件,文字动画效果 this.resizeEvent(); // 设置自适应 this.lazyPicLink(); // 是否加载图片 this.hoverFun();//鼠标经过切换事件 for (var i = 0; i < this.moduleItemObj.length; i++) { this.addVideoLink(this.moduleItemObj.eq(i).find('.e-bg')); } this.setVideoCenterShow(); // 视频居中显示 }, resizeInit: function () { this.winw = this.win.width(); this.winh = this.win.height(); // 获取位置 this.scrollTop = this.win.scrollTop(); this.moduleTop = this.moduleObj.offset().top; }, judgmentSwiper: function () { if (this.moduleSlideObj.length > 1) { if (this.moduleObj.data("swiper-init")) { return; } this.moduleObj.data("swiper-init", true); this.initSwiper(); } }, lazyPicLink: function () { // 加载图片 if (this.scrollTop + this.winh * 1.5 > this.moduleTop) { // 当滚动条滚动到当前位置时,加载视频 this.moduleSlideObj = this.moduleObj.find(".swiper-slide"); this.moduleSlideObj.each(function () { var $this = $(this); var imgObj = $this.find('img'); var src = imgObj.attr("data-original"); if (imgObj.attr("src") != src) { imgObj.attr("src", src) } }) this.moduleSlideObj2 = this.moduleObj.find(".e-bg"); this.moduleSlideObj2.each(function () { var $this = $(this); var imgObj = $this.find('img'); var src = imgObj.attr("data-original"); if (imgObj.attr("src") != src) { imgObj.attr("src", src) } }) } }, initSwiper: function () { var _this = this; // 每次滚动的数量 var slidesPerGroup = 1; if (_this.winw > 992) { slidesPerGroup = 3; } else if (_this.winw > 750) { slidesPerGroup = 2; } else { slidesPerGroup = 1; } var mySwiper = new Swiper($target.find(".swiper"), { watchOverflow: true, // 一屏不显示左右箭头以及pagination spaceBetween: 20, // 板块与板块之间的间距 slidesPerView: 1, //每屏幕显示的个数 slidesPerGroup: slidesPerGroup, // 每次轮播的个数 // 如果需要前进后退按钮 navigation: { nextEl: $target.find('.swiper-button-next'), prevEl: $target.find('.swiper-button-prev'), }, // 如果需要分页器 pagination: { el: $target.find('.swiper-pagination'), type: "fraction", }, breakpoints: { // 最小屏幕 1200: { slidesPerView: 3, spaceBetween: 40, }, 992: { slidesPerView: 3, spaceBetween: 0, }, 750: { slidesPerView: 2, spaceBetween: -10, } }, on: { init: function () { // $target.find(".swiper-pagination").hide(); // 默认先隐藏 // if (_this.winw < 1200) { // $target.find(".swiper-button").css({ // "display": "none" // }) // if (_this.moduleSlideObj.length > 2) { // $target.find(".swiper-pagination").show(); // } // } }, resize: function () { var This = this; setTimeout(function () { if (_this.winw > 992) { slidesPerGroup = 3; } else if (_this.winw > 750) { slidesPerGroup = 2; } else { slidesPerGroup = 1; } // This.emit('init'); This.update(); //窗口变化时,更新Swiper的一些属性,如宽高等 }, 150) }, } }); }, hoverFun: function () { var _this = this; this.moduleSlideObj.eq(0).addClass('active').siblings().removeClass('active'); this.moduleSlideObj.hover(function () { var This = $(this); var _index = This.index(); if (_this.winw > 992) { This.addClass('active').siblings().removeClass('active'); } _this.moduleItemObj.eq(_index).show().siblings().hide(); }) }, scrollEvent: function () { var _this = this; _this.win.on('scroll.202304141421', function () { _this.lazyPicLink(); // 视频是否图片 }); }, setVideoCenterShow: function () { // 设计规则:视频尺寸比例必须是1920*1080 var videoObj = this.moduleListObj.find('.video'); if ((this.moduleListObj.height() / this.winw) > (1080 / 1920)) { // 视频就需要高度100%显示,左右裁切 videoObj.css({ width: 'auto', height: '100%' }) } else { videoObj.css({ width: '100%', height: 'auto' }) } }, addVideoLink: function (bgObj) { if (bgObj.data('src') != undefined && bgObj.data('src') != '' && this.winw > 1200) { // 添加video的dom结构 if (bgObj.find('.video').length == 0) { bgObj.append(""); } // 判断视频是否已经赋值,如果赋值了,就不需要再次赋值了。 var videoObj = bgObj.find('.video'); if (videoObj.attr("src") != bgObj.data('src')) { videoObj.attr("src", bgObj.data('src')); } } else { bgObj.find('.video').remove(); } }, resizeEvent: function () { // 页面resize事件 var _this = this; var resizeWinw = 0; var resizeTimer = ''; this.win.on('resize.202304141421', function () { var winw = _this.win.width(); if (winw != resizeWinw) { currentWinw = winw; // 删除之前的定时器 if (resizeTimer) { clearTimeout(resizeTimer); } // 添加新的定时器 resizeTimer = setTimeout(function () { _this.resizeInit(); // resize初始化 _this.judgmentSwiper(); // 判断需不需要执行swiper _this.scrollEvent(); // 设置滚动事件,文字动画效果 // 添加视频 for (var i = 0; i < _this.moduleItemObj.length; i++) { _this.addVideoLink(_this.moduleItemObj.eq(i).find('.e-bg')); } _this.setVideoCenterShow(); // 视频居中显示 }, 100) } }) } }; module202304141421Obj.init(); } // 初始化 $('.e-module-202304141421').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202304141421Fun($(this)); }) } // 大咖说 if ($('.e-module-202304101126').length > 0) { function module202304101126Fun($target) { var module202304101126Obj = { init: function () { // 获取属性 this.win = $(window); this.moduleObj = $target; this.moduleWrapperObj = this.moduleObj.find(".swiper-wrapper"); this.moduleSlideObj = this.moduleObj.find(".swiper-slide"); this.resizeInit(); // resize初始化 this.judgmentSwiper(); // 判断需不需要执行swiper this.scrollEvent(); // 设置滚动事件,文字动画效果 this.resizeEvent(); // 设置自适应 this.lazyPicLink(); // 是否加载图片 }, resizeInit: function () { this.winw = this.win.width(); this.winh = this.win.height(); // 获取位置 this.scrollTop = this.win.scrollTop(); this.moduleTop = this.moduleObj.offset().top; }, judgmentSwiper: function () { if (this.moduleSlideObj.length > 1) { if (this.moduleObj.data("swiper-init")) { return; } this.moduleObj.data("swiper-init", true); this.initSwiper(); } else if (this.moduleSlideObj.length == 1) { $target.find(".swiper-button").css({ "display": "none" }) $target.find('.img').addClass('img-len1') } }, lazyPicLink: function () { // 加载图片 if (this.scrollTop + this.winh * 1.5 > this.moduleTop) { // 当滚动条滚动到当前位置时,加载视频 this.moduleSlideObj = this.moduleObj.find(".swiper-slide"); this.moduleSlideObj.each(function () { var $this = $(this); var imgObj = $this.find('img'); var src = imgObj.attr("data-original"); if (imgObj.attr("src") != src) { imgObj.attr("src", src) } }) } }, initSwiper: function () { var _this = this; // 每次滚动的数量 var slidesPerGroup = 1; var mySwiper = new Swiper($target.find(".swiper"), { watchOverflow: true, // 一屏不显示左右箭头以及pagination spaceBetween: 20, // 板块与板块之间的间距 slidesPerView: 1, //每屏幕显示的个数 slidesPerGroup: 1, // 每次轮播的个数 // 如果需要前进后退按钮 navigation: { nextEl: $target.find('.swiper-button-next'), prevEl: $target.find('.swiper-button-prev'), }, // 如果需要分页器 pagination: { el: $target.find('.swiper-pagination'), clickable: true, }, breakpoints: { // 最小屏幕 1200: { slidesPerView: 1, spaceBetween: 40, } }, on: { init: function () { }, resize: function () { var This = this; setTimeout(function () { // 不同屏幕下,轮播个数 This.params.slidesPerGroup = 1; // This.emit('init'); This.update(); //窗口变化时,更新Swiper的一些属性,如宽高等 }, 150) }, } }); }, scrollEvent: function () { var _this = this; _this.win.on('scroll.202304101126', function () { // 获取位置 _this.scrollTop = _this.win.scrollTop(); _this.moduleTop = _this.moduleObj.offset().top; _this.lazyPicLink(); // 视频是否图片 }); }, resizeEvent: function () { // 页面resize事件 var _this = this; var resizeWinw = 0; var resizeTimer = ''; this.win.on('resize.202304101126', function () { var winw = _this.win.width(); if (winw != resizeWinw) { currentWinw = winw; // 删除之前的定时器 if (resizeTimer) { clearTimeout(resizeTimer); } // 添加新的定时器 resizeTimer = setTimeout(function () { _this.resizeInit(); // resize初始化 _this.judgmentSwiper(); // 判断需不需要执行swiper _this.scrollEvent(); // 设置滚动事件,文字动画效果 }, 100) } }) } }; module202304101126Obj.init(); } // 初始化 $('.e-module-202304101126').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202304101126Fun($(this)); }) } // 伙伴说 if ($('.e-module-202304111048').length > 0) { function module202304111048Fun($target) { var module202304111048Obj = { init: function () { // 获取属性 this.win = $(window); this.moduleObj = $target; this.tabListObj = this.moduleObj.find('.tabList'); this.listObj = this.moduleObj.find('.list-item'); this.resizeInit(); // resize初始化 // this.judgmentSwiper(); this.clickEvent(); // 加载点击事件 this.resizeEvent(); // 设置自适应 this.lazyPicLink(); // 是否加载图片 }, resizeInit: function () { this.winw = this.win.width(); this.winh = this.win.height(); // 获取位置 this.scrollTop = this.win.scrollTop(); this.moduleTop = this.moduleObj.offset().top; }, lazyPicLink: function () { // 加载图片 if (this.scrollTop + this.winh * 1.5 > this.moduleTop) { // 当滚动条滚动到当前位置时,加载视频 var moduleImgObj = this.moduleObj.find("img"); moduleImgObj.each(function () { var $this = $(this); var src = $this.attr("data-original"); if ($this.attr("src") != src) { $this.attr("src", src) } }) } }, // judgmentSwiper: function () { // if (this.listObj.length > 1) { // if (this.tabListObj.data("swiper-init")) { // return; // } // this.tabListObj.data("swiper-init", true); // this.initSwiper(); // } // }, clickEvent: function () { var _this = this; this.tabListObj.find('.tab-item').eq(0).addClass('active'); _this.listObj.eq(0).addClass('active'); this.tabListObj.find('.tab-item').on('click', function () { // 基础属性 var This = $(this); var _index = This.index(); // 默认显示第一个 This.addClass('active').siblings().removeClass('active'); _this.listObj.eq(_index).addClass('active').siblings().removeClass('active'); }); this.listObj.find('.level-1').on('click', function () { var This = $(this); $(this).parent().toggleClass('active').siblings().removeClass('active') }) }, // initSwiper: function () { // var _this = this; // var mySwiper = new Swiper($target.find(".swiper"), { // slidesPerView: 'auto', // resistanceRatiao: 1, //触底不反弹 // watchOverflow: true, //一屏显示左右按钮和pag // slidesPerGroup: 1, // autoplay: false, // // navigation: { // // nextEl: _this.find('.button-next'), // // prevEl: _this.find('.button-prev') // // }, // on: { // init: function () { // }, // resize: function () { // var This = this; // setTimeout(function () { // // This.emit('init'); // This.update(); //窗口变化时,更新Swiper的一些属性,如宽高等 // }, 150) // }, // } // }); // }, resizeEvent: function () { // 页面resize事件 var _this = this; var resizeWinw = 0; var resizeTimer = ''; this.win.on('resize.202304111048', function () { var winw = _this.win.width(); if (winw != resizeWinw) { currentWinw = winw; // 删除之前的定时器 if (resizeTimer) { clearTimeout(resizeTimer); } // 添加新的定时器 resizeTimer = setTimeout(function () { _this.resizeInit(); // resize初始化 // _this.clickEvent() }, 100) } }) } }; module202304111048Obj.init(); } // 初始化 $('.e-module-202304111048').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202304111048Fun($(this)); }) } // 产业行业专栏 // if ($('.e-module-202304101017').length > 0) { // function module202304101017Fun($target) { // var module202304101017Obj = { // init: function () { // // 获取属性 // this.win = $(window); // this.moduleObj = $target; // this.boxObj = this.moduleObj.find('.box'); // this.resizeInit(); // resize初始化 // this.scrollEvent(); // 设置滚动事件,文字动画效果 // this.resizeEvent(); // 设置自适应 // this.lazyPicLink(); // 是否加载图片 // this.getHeight();//获取高度 // }, // resizeInit: function () { // this.winw = this.win.width(); // this.winh = this.win.height(); // // 获取位置 // this.scrollTop = this.win.scrollTop(); // this.moduleTop = this.moduleObj.offset().top; // }, // lazyPicLink: function () { // // 加载图片 // if (this.scrollTop + this.winh * 1.5 > this.moduleTop) { // // 当滚动条滚动到当前位置时,加载视频 // this.moduleSlideObj = this.moduleObj.find(".box-img"); // this.moduleSlideObj.each(function () { // var $this = $(this); // var imgObj = $this.find('img'); // var src = imgObj.attr("data-original"); // if (imgObj.attr("src") != src) { // imgObj.attr("src", src) // } // }) // } // }, // scrollEvent: function () { // var _this = this; // _this.win.on('scroll.202304101017', function () { // // 获取位置 // _this.scrollTop = _this.win.scrollTop(); // _this.moduleTop = _this.moduleObj.offset().top; // _this.lazyPicLink(); // 视频是否图片 // }); // }, // getHeight: function () { // var _this = this; // if (this.winw > 1200) { // var hList = []; // this.boxObj.find('.text-con p').each(function () { // $(this).height(); // hList.push($(this).height()) // }) // this.boxObj.find('.text-con p').css('height', '0'); // this.boxObj.mouseover(function () { // var _index = $(this).index() // $(this).find('.text-con p').height(hList[_index]) // }) // this.boxObj.mouseout(function () { // $(this).find('.text-con p').height(0) // }) // } // }, // resizeEvent: function () { // // 页面resize事件 // var _this = this; // var resizeWinw = 0; // var resizeTimer = ''; // this.win.on('resize.202304101017', function () { // var winw = _this.win.width(); // if (winw != resizeWinw) { // currentWinw = winw; // // 删除之前的定时器 // if (resizeTimer) { // clearTimeout(resizeTimer); // } // // 添加新的定时器 // resizeTimer = setTimeout(function () { // _this.resizeInit(); // resize初始化 // _this.scrollEvent(); // 设置滚动事件,文字动画效果 // _this.getHeight(); // }, 100) // } // }) // } // }; // module202304101017Obj.init(); // } // // 初始化 // $('.e-module-202304101017').each(function () { // // 防止js文件被执行2次。 // var _this = $(this); // if (_this.data('init')) { // return; // } // _this.data('init', true); // module202304101017Fun($(this)); // }) // } // 精彩回看 if ($('.e-module-202304120948').length > 0) { function module202304120948Fun($target) { var module202304120948Obj = { init: function () { // 获取属性 this.win = $(window); this.moduleObj = $target; this.moduleWrapperObj = this.moduleObj.find(".row-sm"); this.moduleSlideObj = this.moduleObj.find(".row-sm .e-col-xl-3"); this.resizeInit(); // resize初始化 this.scrollEvent(); // 设置滚动事件,文字动画效果 this.resizeEvent(); // 设置自适应 this.lazyPicLink(); // 是否加载图片 // this.addHoverCon(); //hover添加内容 }, resizeInit: function () { this.winw = this.win.width(); this.winh = this.win.height(); // 获取位置 this.scrollTop = this.win.scrollTop(); this.moduleTop = this.moduleObj.offset().top; }, lazyPicLink: function () { // 加载图片 if (this.scrollTop + this.winh * 1.5 > this.moduleTop) { // 当滚动条滚动到当前位置时,加载视频 this.moduleSlideObj = this.moduleObj.find(".row-sm .e-col-xl-3 .img"); this.moduleSlideObj.each(function () { var $this = $(this); var imgObj = $this.find('img'); var src = imgObj.attr("data-original"); if (imgObj.attr("src") != src) { imgObj.attr("src", src) } }) } }, scrollEvent: function () { var _this = this; _this.win.on('scroll.202304120948', function () { _this.lazyPicLink(); // 视频是否图片 }); }, addHoverCon: function () { this.moduleObj.find(".row-sm .e-col-xl-3>.box").each(function (index) { var hoverBox = '
' + $(this).find('.default-box').html() + '
'; $(this).find('.default-box').after(hoverBox) if ($(this).find('.hover_box img').data('xl') != '') { $(this).find('.hover_box img').attr('src', $(this).find('.hover_box img').data('xl')) } }) }, resizeEvent: function () { // 页面resize事件 var _this = this; var resizeWinw = 0; var resizeTimer = ''; this.win.on('resize.202304120948', function () { var winw = _this.win.width(); if (winw != resizeWinw) { currentWinw = winw; // 删除之前的定时器 if (resizeTimer) { clearTimeout(resizeTimer); } // 添加新的定时器 resizeTimer = setTimeout(function () { _this.resizeInit(); // resize初始化 _this.scrollEvent(); // 设置滚动事件,文字动画效果 }, 100) } }) } }; module202304120948Obj.init(); } // 初始化 $('.e-module-202304120948').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202304120948Fun($(this)); }) }