define("/Assets/enp/2022/js/module/e-module-202208041325.js", function (s, pub) { if ($('.e-module-202208041325').length > 0) { function module202208041325Fun($target) { var module202208041325Obj = { init: function () { // 获取属性 this.win = $(window); this.moduleObj = $target; this.tabListObj = this.moduleObj.find('.tablist'); this.listConObj = this.moduleObj.find('.list-con'); this.listObj = this.moduleObj.find('.list'); this.navFixedBox = $(".e-module-202208091539 .fixed-box"); this.resizeInit(); // resize初始化 this.judgmentBtnShowHide(); // 是否显示加载更多按钮 this.judgmentNavPosition(); // 判断右侧tab是否取消定位 this.clickEvent(); // 加载点击事件 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; this.perScrollTop = 0; }, 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) } }) } }, judgmentBtnShowHide: function () { this.listObj.each(function () { var This = $(this); if (This.find('.box2').length > 9) { This.find('.e-btn-box').show(); } if (This.find('.box3').length > 6) { This.find('.e-btn-box').show(); } if (This.find('.box5').length > 6) { This.find('.e-btn-box').show(); } }); }, judgmentNavPosition: function () { if (this.winw < 920) { this.tabListObj.attr('style', ' ') } }, clickEvent: function () { var _this = this; this.tabListObj.find('li').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'); // 博客板块需要js计算高度 if (_this.moduleObj.find('.list5.active').length > 0 && _this.winw > 750) { ebgLib.v3SetHeight(_this.listObj, '.box5', '.fiv-tit'); ebgLib.v3SetHeight(_this.listObj, '.box5', '.ints'); } // 图片显示后,给图片手动触发懒加载 // _this.moduleObj.find('img').trigger("callback_loaded"); if (_this.winw > 920) { // 判断板块位置,如果页面滚动到一半,要重新滚动到板块最上面 var fixedBoxH = _this.navFixedBox.length == 0 ? 0 : _this.navFixedBox.height(); var top = _this.listConObj.offset().top - 60 - fixedBoxH - 40; $("body,html").stop(true, true).animate({ "scrollTop": top }); // 点击后左侧不定位了 _this.tabListObj.attr('style', ' '); } if (_this.winw < 920) { if (_index > 2) { _this.tabListObj.scrollLeft(240) } } }); this.moduleObj.find('.J-loadmore-one').on('click', function () { var btnObj = $(this); var list = $(this).parents('.list'); var box2Obj = list.find('.box2'); var box3Obj = list.find('.box3'); var box5Obj = list.find('.box5'); if (box2Obj.length > 0) { var num = 0; box2Obj.each(function () { var This = $(this); if (This.css('display') == 'none' && num < 9) { This.css('display', 'block'); num++; } // 隐藏按钮 if ((box2Obj.length - 1) == This.index() && This.css('display') == 'block') { btnObj.css('display', 'none'); } }) } if (box3Obj.length > 0) { var num = 0; box3Obj.each(function () { var This = $(this); if (This.css('display') == 'none' && num < 6) { This.css('display', 'block'); num++; } // 隐藏按钮 if ((box3Obj.length - 1) == This.index() && This.css('display') == 'block') { btnObj.css('display', 'none'); } }) } // 博客 if (box5Obj.length > 0) { var num = 0; box5Obj.each(function () { var This = $(this); if (This.css('display') == 'none' && num < 6) { This.css('display', 'block'); num++; } // 隐藏按钮 if ((box5Obj.length - 1) == This.index() && This.css('display') == 'block') { btnObj.css('display', 'none'); } }) // 博客板块需要js计算高度 if (btnObj.parents('.list5.active').length > 0 && _this.winw > 750) { ebgLib.v3SetHeight(_this.listObj, '.box5', '.fiv-tit'); ebgLib.v3SetHeight(_this.listObj, '.box5', '.ints'); } } }) }, scrollEvent: function () { var _this = this; // 当鼠标滚动的时候 this.win.on('scroll.202208041325', function () { if (_this.winw > 920) { // 获取位置 _this.scrollTop = _this.win.scrollTop(); _this.moduleTop = _this.moduleObj.offset().top; var head_h = 60 //头部高度 var navH = _this.navFixedBox.length == 0 ? 0 : _this.navFixedBox.height(); //定位导航高度 var listconTop = _this.listConObj.offset().top; var listconH = _this.listConObj.height(); var tablistH = _this.tabListObj.height(); var tablistW = _this.moduleObj.find('.tabBan').outerWidth(); var tablistL = _this.moduleObj.find('.tabBan').offset().left; // 判断左侧内容是够超过右侧内容高度,如果超过了,导航就不定位了,没有超过就定位 if (tablistH >= listconH) { _this.tabListObj.attr('style', ' '); } else { // 判断滚动条是往上还是往下滚动 if (_this.scrollTop - _this.perScrollTop >= 10) { //向下 // 判断滚动条滚动到什么位置 if (_this.scrollTop > (listconTop - head_h - navH - 40) && _this.scrollTop < (listconTop + listconH - tablistH - head_h - navH - 40)) { //顶部交界处 _this.tabListObj.css({ 'position': 'fixed', 'left': tablistL, 'top': (head_h + navH + 40), 'width': tablistW }) } else if (_this.scrollTop > (listconTop + listconH - tablistH - head_h - navH - 40)) { //底部交界处 _this.tabListObj.css({ 'position': 'absolute', 'left': 0, 'top': (listconH - tablistH), 'width': tablistW }) } _this.perScrollTop = _this.scrollTop; } else if (_this.scrollTop - _this.perScrollTop <= -10) { //向上 // 判断滚动条滚动到什么位置 if (_this.scrollTop > listconTop && _this.scrollTop < (listconTop + listconH - tablistH - head_h - navH - 40)) { //顶部交界处 _this.tabListObj.css({ 'position': 'fixed', 'left': tablistL, 'top': (head_h + navH + 40), 'width': tablistW }) } else if (_this.scrollTop < (listconTop - head_h - navH - 40)) { //底部交界处 _this.tabListObj.css({ 'position': 'static', 'left': 0, 'top': 0, 'width': tablistW }) } _this.perScrollTop = _this.scrollTop; } } } _this.lazyPicLink(); // 视频是否图片 }) }, resizeEvent: function () { // 页面resize事件 var _this = this; var resizeWinw = 0; var resizeTimer = ''; this.win.on('resize.202208041325', function () { var winw = _this.win.width(); if (winw != resizeWinw) { currentWinw = winw; // 删除之前的定时器 if (resizeTimer) { clearTimeout(resizeTimer); } // 添加新的定时器 resizeTimer = setTimeout(function () { _this.resizeInit(); // resize初始化 _this.judgmentNavPosition(); // 判断右侧tab是否取消定位 _this.scrollEvent(); // 设置滚动事件,文字动画效果 }, 100) } }) } }; module202208041325Obj.init(); } // 初始化 $('.e-module-202208041325').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202208041325Fun($(this)); }) } });