$(function () { var winW = $(window).width(); // cookie if ($('.e-module-202208270930').length > 0) { function module202208270930Fun($target) { var module202208270930Obj = { init: function () { // 获取属性 this.win = $(window); this.moduleObj = $target; this.setShowHide(); this.clickEvent(); }, setShowHide: function () { var _this = this; var lang = $("#gLanguageCurrent").val(); _this.cookie_name = "browsehappy"; if (lang == "en" || lang == "en-gb" || lang == "fr-fr" || lang == "de" || lang == "it" || lang == "es") { _this.cookie_name = "browsehappy_other"; } if ($.cookie(_this.cookie_name)) { return false; } else { _this.moduleObj.slideDown(function () { $(this).trigger("slideEnd"); _this.win.trigger("scroll"); }); } }, clickEvent: function () { var _this = this; _this.moduleObj.find('a.close').click(function () { $(this).parents('.browsehappy').slideUp(function () { $(this).trigger("slideEnd"); _this.win.trigger("scroll"); $.cookie(_this.cookie_name, 'browsehappy', { expires: 30, path: '/', domain: 'huawei.com' }) }); }) }, }; module202208270930Obj.init(); } // 初始化 $('.e-module-202208270930').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202208270930Fun($(this)); }) } var res1 = $('.e-module-202208270930'); var resourceObj = $('.bz-header'); if ($('.e-module-202305041413').length > 0) { function module202305041413Fun($target) { var module202305041413Obj = { init: function () { // 获取属性 this.win = $(window); this.moduleObj = $target; this.cookieObj = $('.e-module-202208270930'); this.resizeInit(); // resize初始化 this.setBannerHeight(); // resize初始化 // 添加视频 this.addVideoLink(this.moduleObj.find('.e-bg')); // this.lazyPicLink(); // 是否加载图片 this.setVideoCenterShow(); // 视频居中显示 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; }, setBannerHeight: function () { if (this.cookieObj.css('display') == 'block') { this.moduleObj.height(this.winh - 52); } else { this.moduleObj.height(this.winh); } }, setVideoCenterShow: function () { // 设计规则:视频尺寸比例必须是1920*1080 var videoObj = this.moduleObj.find('.video'); if ((this.moduleObj.height() / this.winw) > (1300 / 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.202305041413', function () { var winw = _this.win.width(); if (winw != resizeWinw) { currentWinw = winw; // 删除之前的定时器 if (resizeTimer) { clearTimeout(resizeTimer); } // 添加新的定时器 resizeTimer = setTimeout(function () { _this.resizeInit(); // resize初始化 _this.setBannerHeight(); _this.setVideoCenterShow(); // 视频居中显示 }, 100) } }) } }; module202305041413Obj.init(); } // 初始化 $('.e-module-202305041413').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202305041413Fun($(this)); }) } // function setVideoBg() { // if (winW > 1200) { // $('.video-bg').each(function () { // $(this).find('video').attr('src', $(this).data('url')); // }) // } else { // $('.video-bg video').remove(); // } // } // setVideoBg(); // $(window).on('scroll.202305061014', function () { // var t = $(window).scrollTop() // var headerTopH = res1.height(); // console.log(headerTopH) // if (t > headerTopH) { // resourceObj.addClass("fixed"); // $('.main-bg').addClass('top') // } else { // resourceObj.removeClass("fixed") // $('.main-bg').removeClass('top') // }; // }) // 导航 $("#mob-menubtn").on("click", function () { $('.main-header').addClass('open'); $('#close-menubtn').show(); $('#mob-menubtn').hide(); $('body').css('overflow', 'hidden') }) $("#close-menubtn").on("click", function () { closeMenu() }) //mob端关闭导航 function closeMenu() { // $('.nav-new').removeClass('active') $('.main-header').removeClass('open'); $('#close-menubtn').hide(); $('#mob-menubtn').show(); $('body').css('overflow', 'auto') // $('.logo img').attr('src', 'https://e.huawei.com/topic/sitecore/2023-mwc/img/banner/logo_huawei2.png'); // if ($(".bz-header").hasClass('fix')) { // $('.logo img').attr('src', 'https://e.huawei.com/topic/sitecore/2023-mwc/img/banner/logo_huawei.png'); // } } // 定位导航 function fixedNav() { // 基础对象 var winW = $(window).width(); // 对象 var navObj = $('.bz-header'); var liObj = navObj.find('.li'); var boxObj = $('.anchorpoint'); if ($('.e-module-202208270930').css('display') == 'block') { navObj.css("top", "52px"); } else { navObj.css("top", 0); } $('.e-module-202208270930').on("click", function () { navObj.animate({ "top": 0 }); }) // 锚点定位,如果链接有带参数,自动触发点击事件 anchorFun(); // 点击导航栏按钮事件 liObj.on('click', function (e) { // 阻止时间冒泡 e.stopPropagation(); var _this = $(this); clickEvent(_this); }); // 滚动页面,导航栏跟着变化事件 $(window).on("scroll.bz-header", function () { // 获取滚动条当前位置 var scrollTop = $(window).scrollTop(); // // 显示、隐藏当前导航栏 if (scrollTop >= 70) { navObj.addClass('fix'); } else { navObj.removeClass('fix'); } // 获取每个版块的到页面顶部的位置 var anchorpointArr = []; boxObj.each(function () { anchorpointArr.push(Math.ceil($(this).offset().top - 80)); }) // 获取当前可预览的板块在哪个位置 var curLightHighIndex = 0; for (var i = 0; i < anchorpointArr.length; i++) { if (scrollTop >= anchorpointArr[i]) { curLightHighIndex = i; liObj.eq(curLightHighIndex).addClass('active').siblings().removeClass('active'); } else { curLightHighIndex = i; liObj.eq(curLightHighIndex).removeClass('active') } } // 当前导航栏跟着页面滚动高亮当前按钮 // liObj.eq(curLightHighIndex).addClass('active').siblings().removeClass('active'); }) function clickEvent(obj) { if (winW < 992) { closeMenu() } // 获取点击位置 var li_index = obj.index(); // 获取位置的top值 var willScrollTop = Math.ceil(boxObj.eq(li_index).offset().top - 80); // console.log(willScrollTop) // 执行动画 $("body,html").stop(true, true).animate({ "scrollTop": willScrollTop }, 300); // 高亮当前定位按钮 // obj.addClass('active').siblings().removeClass('active'); }; // 获取链接参数 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]); } // 锚点定位函数 function anchorFun() { var queryStr = getQueryString("section"); if (queryStr == undefined) return // 清除滚动条默认位置 if ('scrollRestoration' in history) { history.scrollRestoration = 'manual'; } liObj.each(function () { var _this = $(this); if (_this.data('key') == queryStr) { setTimeout(function () { _this.trigger('click'); }, 500) } }) } } function init() { fixedNav(); // 定位导航 } init(); // invitation // var $con = $(".intro-box"); // var conHeight = $con.outerHeight(); // if ($con.hasClass('active')) { // $(".z_tanchu .text").text($(".z_tanchu").attr('data-shouqi')) // } else { // $(".z_tanchu .text").text($(".z_tanchu").attr('data-zhankai')) // } // if (winW < 768) { // $con.outerHeight("300") // $(".intro-box").on("click", ".z_tanchu", function () { // $con.toggleClass("active"); // if ($con.hasClass("active")) { // $con.outerHeight("auto") // $(".z_tanchu .text").text($(".z_tanchu").attr('data-shouqi')) // } else { // $con.outerHeight("300") // $(".z_tanchu .text").text($(".z_tanchu").attr('data-zhankai')) // } // }) // } if ($('.e-module-202305061423').length > 0) { function module202305061423Fun($target) { var module202305061423Obj = { init: function () { // 获取属性 this.win = $(window); this.moduleObj = $target; this.introBox = this.moduleObj.find(".intro-box"); this.resizeInit(); // resize初始化 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) // } // }) // } // }, clickEvent: function () { var _this = this; if (this.introBox.hasClass('active')) { this.introBox.find(".z_tanchu .text").text(this.introBox.find(".z_tanchu").attr('data-shouqi')) } else { this.introBox.find(".z_tanchu .text").text(this.introBox.find(".z_tanchu").attr('data-zhankai')) } if (this.winw < 768) { this.introBox.outerHeight("300"); $('.z_tanchu').on("click", function () { $('.intro-box').toggleClass("active"); if ($('.intro-box').hasClass("active")) { $('.intro-box').outerHeight("auto") $('.intro-box').find(".z_tanchu .text").text($('.intro-box').find(".z_tanchu").attr('data-shouqi')) } else { $('.intro-box').outerHeight("300") $('.intro-box').find(".z_tanchu .text").text($('.intro-box').find(".z_tanchu").attr('data-zhankai')) } }) } else { $('.intro-box').outerHeight("100%") } }, resizeEvent: function () { // 页面resize事件 var _this = this; var resizeWinw = 0; var resizeTimer = ''; this.win.on('resize.202305061423', function () { var winw = _this.win.width(); if (winw != resizeWinw) { currentWinw = winw; // 删除之前的定时器 if (resizeTimer) { clearTimeout(resizeTimer); } // 添加新的定时器 resizeTimer = setTimeout(function () { _this.resizeInit(); // resize初始化 _this.clickEvent(); // 加载点击事件 }, 100) } }) } }; module202305061423Obj.init(); } // 初始化 $('.e-module-202305061423').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202305061423Fun($(this)); }) } if ($('.e-module-202305061523').length > 0) { function module202305061523Fun($target) { var module202305061523Obj = { init: function () { // 获取属性 this.win = $(window); this.moduleObj = $target; this.tabListObj = this.moduleObj.find('.act-tablist'); this.listObj = this.moduleObj.find('.act-item'); this.dayTabListObj = this.moduleObj.find('.day-tabList'); this.dayListObj = this.moduleObj.find('.day-item'); this.index = 0; this.resizeInit(); // resize初始化 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) // } // }) // } // }, clickEvent: function () { var _this = this; // _this.tabListObj.find('.act-tab').eq(0).addClass('active'); //大tab // _this.listObj.eq(0).addClass('active'); //大item // _this.dayTabListObj.find('.day-tab').eq(0).addClass('active'); //日期tab // _this.dayListObj.eq(0).addClass('active'); //日期item // _this.dayListObj.find('.time-con').eq(0).addClass('active'); this.tabListObj.find('.act-tab').on('click', function () { // 清空 _this.listObj.find(".active").removeClass("active"); // 基础属性 var This = $(this); var _index = This.index(); // 默认显示第一个 This.addClass('active').siblings().removeClass('active'); _this.listObj.eq(_index).addClass('active').siblings().removeClass('active'); _this.listObj.eq(_index).find('.day-tab').eq(_this.index).addClass('active').siblings().removeClass('active'); _this.listObj.eq(_index).find('.day-item').eq(_this.index).addClass('active'); if (_this.listObj.eq(_index).find('.day-item').eq(_this.index).find('.time-con').length == 1) { _this.listObj.eq(_index).find('.day-item').eq(_this.index).find('.time-con').eq(0).addClass('active'); } }); this.tabListObj.find('.act-tab').eq(0).trigger("click"); _this.dayTabListObj.find('.day-tab').on('click', function () { // 基础属性 var This = $(this); _this.index = This.index(); // 默认显示第一个 This.addClass('active').siblings().removeClass('active'); This.parents(".act-item").find(".day-item").eq(_this.index).addClass('active').siblings().removeClass('active'); if (This.parents(".act-item").find(".day-item").eq(_this.index).find('.time-con').length == 1) { This.parents(".act-item").find(".day-item").eq(_this.index).find('.time-con').eq(0).addClass('active'); } }); this.dayListObj.find('.time-con .icon-xiala1').on('click', function () { $(this).parents('.time-con').toggleClass('active'); }); }, resizeEvent: function () { // 页面resize事件 var _this = this; var resizeWinw = 0; var resizeTimer = ''; this.win.on('resize.202305061523', function () { var winw = _this.win.width(); if (winw != resizeWinw) { currentWinw = winw; // 删除之前的定时器 if (resizeTimer) { clearTimeout(resizeTimer); } // 添加新的定时器 resizeTimer = setTimeout(function () { _this.resizeInit(); // resize初始化 }, 100) } }) } }; module202305061523Obj.init(); } // 初始化 $('.e-module-202305061523').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202305061523Fun($(this)); }) } var $goTop = $(".slide-item3"); $(window).on('scroll.gotop', function () { var high = $(window).scrollTop(); // 三元表达式进行高度判断 if (winW > 1200) { high >= 700 ? $goTop.fadeIn() : $goTop.fadeOut(); } }) $goTop.on('click', function () { $("html, body").animate({ scrollTop: 0 }); }) // 直播框,判断是否存在 // if ($('.e-module-202302141124').length > 0) { // function module202302141124Fun($target) { // var module202302141124Obj = { // init: function () { // // 不可变的对象 // this.moduleObj = $target; // this.iframeobj = $target.find('.live-iframe'); // this.tabObj = this.moduleObj.find('.tab-info'); // this.liveConObj = this.moduleObj.find('.live-con'); // this.resizeInit(); // 执行变量 // this.setLiveConH(); // 设置右边tab的高度 // this.clickEvent(); // 设置点击事件 // this.resizeEvent(); // 添加resize事件 // }, // resizeInit: function () { // // 可变的对象 // this.win = $(window); // this.winw = this.win.width(); // this.tabObjH = this.tabObj.height(); // }, // setLiveConH: function () { // if (this.winw > 1200) { // this.liveConObj.css({ // 'max-height': this.iframeobj.height() - 40 - this.tabObjH, // 'overflow': 'auto', // }) // } // if (this.winw > 992 && this.winw < 1200) { // this.liveConObj.css({ // 'max-height': this.iframeobj.height() - 30 - this.tabObjH, // 'overflow': 'auto', // }) // } // }, // clickEvent: function () { // var _this = this; // // 点击切换tab // this.moduleObj.find('.tab-info li').on('click', function () { // var _index = $(this).index(); // $(this).addClass('active').siblings().removeClass('active'); // _this.moduleObj.find('.live-item').eq(_index).addClass('active').siblings().removeClass('active') // }); // // 点击切换视频 // this.moduleObj.find('.timeline-card').on('click', function () { // var _index = $(this).index(); // $(this).addClass('active').siblings().removeClass('active'); // }) // }, // resizeEvent: function () { // // 页面resize事件 // var _this = this; // var resizeWinw = 0; // var resizeTimer = ''; // this.win.on('resize.202302141124', function () { // var winw = _this.win.width(); // if (winw != resizeWinw) { // currentWinw = winw; // // 删除之前的定时器 // if (resizeTimer) { // clearTimeout(resizeTimer); // } // // 添加新的定时器 // resizeTimer = setTimeout(function () { // _this.resizeInit(); // 执行变量 // _this.setLiveConH(); // 设置右边tab的高度 // }, 200) // } // }) // } // } // // 初始化 // module202302141124Obj.init(); // } // // 遍历模板 // $('.e-module-202302141124').each(function () { // module202302141124Fun($(this)); // }) // } var $backtop = $(".backtop"); $(window).on('scroll.backtop', function () { var high = $(window).scrollTop(); // 三元表达式进行高度判断 // if (winW > 1200) { high >= 700 ? $backtop.fadeIn() : $backtop.fadeOut(); // } }) $backtop.on('click', function () { $("html, body").animate({ scrollTop: 0 }); }) // 展台 if ($('.e-module-202305101011').length > 0) { function module202305101011Fun($target) { var module202305101011Obj = { init: function () { // 获取属性 this.win = $(window); this.moduleObj = $target; this.resizeInit(); this.judgmentPcWap(); 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; }, judgmentPcWap: function () { if (this.winw < 992) { this.clickEvent(); } }, clickEvent: function () { // 获取对象 var lookFullBtn = this.moduleObj.find('.full-img'); var viewBox = this.moduleObj.find('.view-box'); var closeFull = this.moduleObj.find('.view-box .close-full'); // 点击放大按钮,弹框 lookFullBtn.on('click', function () { var oImg = $(this).parent('.box-img').find('img').attr('data-original'); viewBox.find('img').attr('src', oImg); viewBox.fadeIn(400); $('body').css('overflow', 'hidden') eZoom(viewBox.find('img')) }) // 点击关闭按钮关闭弹框 closeFull.on('click', function () { viewBox.fadeOut(400) $('body').css('overflow', 'auto') }) // 点击弹框的黑色遮罩,关闭弹框 viewBox.on('click', function () { viewBox.fadeOut(400) $('body').css('overflow', 'auto') }) }, resizeEvent: function () { // 页面resize事件 var _this = this; var resizeWinw = 0; var resizeTimer = ''; this.win.on('resize.202209070955', function () { var winw = _this.win.width(); if (winw != resizeWinw) { currentWinw = winw; // 删除之前的定时器 if (resizeTimer) { clearTimeout(resizeTimer); } // 添加新的定时器 resizeTimer = setTimeout(function () { _this.resizeInit(); // resize初始化 _this.judgmentPcWap(); // 判断移动还是pc端 }, 100) } }) } }; module202305101011Obj.init(); } // 初始化 $('.e-module-202305101011').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202305101011Fun($(this)); }) } // 场景化解决方案 if ($('.e-module-202305091750').length > 0) { function module202305091750Fun($target) { var module202305091750Obj = { 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.addVideoLink(); // 视频是否加载 this.lazyPicLink(); // 是否加载图片 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) } }) } }, addVideoLink: function () { // 加载视频 if (this.scrollTop + this.winh * 1.5 > this.moduleTop) { if (this.winw > 1200) { this.moduleBgObj = $target.find(".e-bg"); if (this.moduleBgObj.data('src') != '' && this.moduleBgObj.find('.video').length == 0) { // 添加video的dom结构 this.moduleBgObj.append(""); // 判断视频是否已经赋值,如果赋值了,就不需要再次赋值了。 this.moduleBgObj.find('.video').attr("src", this.moduleBgObj.data('src')); } } else { $target.find('.video').remove(); } } }, setVideoCenterShow: function () { // 设计规则:视频尺寸比例必须是1920*1080 if (this.moduleObj.find('.video').length > 0) { var videoObj = this.moduleObj.find('.video'); if ((this.moduleObj.height() / this.winw) > (1080 / 1920)) { // 视频就需要高度100%显示,左右裁切 videoObj.css({ width: 'auto', height: '100%' }) } else { videoObj.css({ width: '100%', height: 'auto' }) } } }, initSwiper: function () { var _this = this; // 每次滚动的数量 var slidesPerGroup = 1; if (_this.winw > 1200) { slidesPerGroup = 3; } 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, type: 'fraction', }, breakpoints: { // 最小屏幕 1200: { slidesPerView: 3, spaceBetween: 40, }, 920: { slidesPerView: 2.5, spaceBetween: 20, }, 750: { slidesPerView: 2, spaceBetween: 20, } }, on: { init: function () { // 在不同屏幕下,是否显示点点点 $target.find(".swiper-pagination").hide(); // 默认先隐藏 if (_this.winw > 1200) { if (_this.moduleSlideObj.length > 3) { $target.find(".swiper-pagination").show(); $target.find(".swiper-btn").css({ "display": "flex" }) } else if (_this.moduleSlideObj.length == 3) { $target.find(".swiper-pagination").hide(); } } else if (_this.winw > 750) { $target.find(".swiper-btn").css({ "display": "none" }) if (_this.moduleSlideObj.length > 2) { $target.find(".swiper-pagination").show(); } } else { $target.find(".swiper-btn").css({ "display": "none" }) if (_this.moduleSlideObj.length > 1) { $target.find(".swiper-pagination").show(); } } }, resize: function () { var This = this; setTimeout(function () { // 不同屏幕下,轮播个数 if (_this.winw > 1200) { This.params.slidesPerGroup = 3; } 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.202305091750', 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.202305091750', 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(); // 设置滚动事件,文字动画效果 _this.setVideoCenterShow(); // 视频居中显示 }, 100) } }) } }; module202305091750Obj.init(); } // 初始化 $('.e-module-202305091750').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202305091750Fun($(this)); }) } // speaker if ($('.e-module-202301121149').length > 0) { function module202301121149Fun($target) { var module202301121149Obj = { 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(); } }, 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 = 2; if (_this.winw > 992) { slidesPerGroup = 4; } var slideLength = $target.find(".swiper-slide").length; var mySwiper = new Swiper($target.find(".swiper"), { watchOverflow: true, // 一屏不显示左右箭头以及pagination spaceBetween: 20, // 板块与板块之间的间距 slidesPerView: 2, //没屏幕显示的个数 resistanceRatiao: 1, //触底不反弹 slidesPerGroup: slidesPerGroup, // 每次轮播的个数 autoplay: $target.data("auto-time") ? { delay: $target.data("auto-time"), stopOnLastSlide: false, disableOnInteraction: true } : false, loop: slideLength > 2 ? true : false, // 设置自动轮播 noSwiping: slideLength > 1 ? false : true, // 如果需要前进后退按钮 navigation: { nextEl: $target.find('.swiper-button-next'), prevEl: $target.find('.swiper-button-prev'), }, pagination: { // 设置点点点 el: $target.find('.swiper-pagination'), clickable: true, clickable: true, }, breakpoints: { 1200: { slidesPerView: 4, spaceBetween: 40, loop: slideLength > 4 ? true : false, // 设置自动轮播 }, 992: { slidesPerView: 4, spaceBetween: 20, loop: slideLength > 4 ? true : false, // 设置自动轮播 }, }, on: { init: function () { if (_this.winw > 992) { if (_this.moduleSlideObj.length < 5) { $target.find('.swiper-button').hide(); $target.find('.swiper-wrapper').css('justify-content', 'space-around'); } if (_this.winw > 992 && _this.winw < 1200) { $target.find('.swiper-pagination').hide(); } } else { if (_this.moduleSlideObj.length < 3) { $target.find('.swiper-pagination').hide(); } } }, resize: function () { var This = this; setTimeout(function () { // 不同屏幕下,轮播个数 if (_this.winw > 992) { slidesPerGroup = 4; } else { slidesPerGroup = 2; } This.emit('init'); This.update(); //窗口变化时,更新Swiper的一些属性,如宽高等 }, 150) }, } }); }, scrollEvent: function () { var _this = this; _this.win.on('scroll.202301121149', 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.202301121149', 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) } }) } }; module202301121149Obj.init(); } // 初始化 $('.e-module-202301121149').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202301121149Fun($(this)); }) } // 成功案例 if ($('.e-module-202208091544').length > 0) { function module202208091544Fun($target) { var module202208091544Obj = { init: function () { // 获取属性 this.win = $(window); this.moduleObj = $target; this.moduleSlideObj = $target.find(".swiper-slide"); this.resizeInit(); // resize初始化 this.addClass(); // 根据slide个数,给模块添加calss 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 && this.winw > 1200) || (this.moduleSlideObj.length > 2 && this.winw > 750) || (this.moduleSlideObj.length > 1 && this.winw < 750)) { if (this.moduleObj.data("swiper-init")) { return; } this.moduleObj.data("swiper-init", true); this.initSwiper(); } else { this.setTextBgHeight(); } }, setTextBgHeight: function () { var swiperBgObj = this.moduleObj.find('.swiper-bg'); swiperBgObj.height("auto"); if (this.winw > 1200) { var H = 0; swiperBgObj.each(function () { var This = $(this); if (H < This.outerHeight(true)) { H = This.outerHeight(true) } }) var num = parseInt(swiperBgObj.css('padding-top')) + parseInt(swiperBgObj.css('padding-bottom')); var cH = this.moduleSlideObj.find('.e-lazy').eq(0).height() + 70; if (H > cH) { swiperBgObj.height(H - num) } else { swiperBgObj.height(cH - num) } } }, addClass: function () { if (this.moduleSlideObj.length == 1) { this.moduleObj.addClass("quantity1"); } else if (this.moduleSlideObj.length == 2) { this.moduleObj.addClass("quantity2"); } else { this.moduleObj.addClass("quantity3"); } }, 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 && _this.winw > 750) { slidesPerGroup = 2; } var slideLength = $target.find(".swiper-slide").length; var mySwiper = new Swiper($target.find(".swiper"), { 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 }, 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, // 触发一次回调函数 breakpoints: { 1200: { slidesPerView: 1, spaceBetween: 40, }, 920: { slidesPerView: 2.5, spaceBetween: 20, }, 750: { slidesPerView: 2, spaceBetween: 20, } }, on: { init: function () { $target.find(".swiper-pagination").show(); // 每次滚动的数量 if (_this.winw < 1200 && _this.winw > 750) { this.params.slidesPerGroup = 2; } else { this.params.slidesPerGroup = 1; } // 处理数字显示问题 if (_this.winw > 1200) { $target.find(".pagination").show(); $target.find(".swiper-button").css({ "display": "flex" }); if (slideLength < 10) { $target.find('.allSlide').text('0' + slideLength) } else { $target.find('.allSlide').text(slideLength) } $target.find('.slideCur').text('0' + 1) } else { $target.find(".pagination").hide(); $target.find(".swiper-button").hide(); } // 设置pc端白色文字的背景图片高度 _this.setTextBgHeight(); }, slideChangeTransitionEnd: function () { // 设置数字的文字,给数字前面加个0 if (_this.winw > 1200) { var index = this.realIndex; index += 1; if (index < 10) { $target.find('.slideCur').text('0' + index); } else { $target.find('.slideCur').text(index); } } }, resize: function () { var _this = this; setTimeout(function () { _this.emit('init'); _this.emit('slideChangeTransitionEnd'); _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.202208091544', function () { // 获取位置 _this.scrollTop = _this.win.scrollTop(); _this.moduleTop = $target.offset().top; _this.lazyPicLink(); // 视频是否图片 }); }, resizeEvent: function () { // 页面resize事件 var _this = this; var resizeWinw = 0; var resizeTimer = ''; this.win.on('resize.202208091544', function () { var winw = _this.win.width(); if (winw != resizeWinw) { currentWinw = winw; // 删除之前的定时器 if (resizeTimer) { clearTimeout(resizeTimer); } // 添加新的定时器 resizeTimer = setTimeout(function () { _this.resizeInit(); // resize初始化 _this.scrollEvent(); // 设置滚动事件,文字动画效果 _this.setTextBgHeight(); }, 100) } }) } }; module202208091544Obj.init(); } // 初始化 $('.e-module-202208091544').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202208091544Fun($(this)); }) } // 华为智慧金融伙伴出海计划 (FPGGP) if ($('.e-module-202208150943').length > 0) { function module202208150943Fun($target) { var module202208150943Obj = { init: function () { // 获取属性 this.win = $(window); this.animateOff = false; this.moduleObj = $target; this.moduleSlideObj = $target.find(".swiper-slide"); this.activeIndex = 0; this.resizeInit(); // resize初始化 this.saveAClass(); // 保存按钮颜色 this.setWapBtnColor(); // 设置按钮颜色 this.judgmentHomeOther(); // 判断是否是首页,还是内页。如果是首页pc就执行动画,其他的不用执行 this.judgmentSwiper(); // 判断需不需要执行swiper,如果只有一个就不需要执行。多个就需要执行 this.scrollEvent(); // 设置滚动事件,文字动画效果 this.resizeEvent(); // 设置自适应 }, resizeInit: function () { this.winw = this.win.width(); this.winh = this.win.height(); }, judgmentHomeOther: function () { if ($target.hasClass('h600')) { this.judgmentPcWap(); } }, judgmentPcWap: function () { // 判断首页是pc还是移动 if (this.winw > 1200) { // pc端执行动画 this.judgmentAnimate(); } else { // 移动端直接显示文字,不用执行动画 $target.find(".swiper-slide").addClass('animate'); } }, judgmentAnimate: function () { var _this = this; // 获取滚动条位置 _this.scrollTop = _this.win.scrollTop(); _this.moduleTop = $target.offset().top; var $targetH = $target.height(); // 判断是否在屏幕中,如果是显示动画,不是就不执行 if (_this.scrollTop + _this.winh - $targetH > _this.moduleTop) { if (!_this.animateOff) { // 如果只有第一屏,就显示第一屏 if ($target.find(".swiper-slide").length == 1) { $target.find(".swiper-slide").eq(0).addClass('animate'); } else { // 显示当前轮播屏 _this.moduleSlideObj.eq(_this.activeIndex).addClass('animate').siblings().removeClass('animate'); } _this.animateOff = true; } } }, judgmentSwiper: function () { if (this.moduleSlideObj.length > 1) { if (this.moduleObj.data("swiper-init")) { return; } this.moduleObj.data("swiper-init", true); this.initSwiper(); } }, saveAClass: function () { var _this = this; _this.aClassArr = []; $target.find('a').each(function () { _this.aClassArr.push($(this).attr('class')); }) }, setWapBtnColor: function () { var _this = this; // 不管pc端按钮是什么颜色,到了移动端都是黑色按钮 if (this.winw < 992) { $target.find('.e-btn-bd-white-xl').addClass('e-btn-bd-black-xl').removeClass('e-btn-bd-white-xl'); $target.find('.e-btn-bd-white-lg').addClass('e-btn-bd-black-lg').removeClass('e-btn-bd-white-lg'); $target.find('.e-btn-bd-white-video-xl').addClass('e-btn-bd-black-video-xl').removeClass('e-btn-bd-white-video-xl'); $target.find('.e-btn-bd-white-video-lg').addClass('e-btn-bd-black-video-lg').removeClass('e-btn-bd-white-video-lg'); $target.find('.e-btn-bd-red-xl').addClass('e-btn-bd-black-xl').removeClass('e-btn-bd-red-xl'); $target.find('.e-btn-bd-red-lg').addClass('e-btn-bd-black-lg').removeClass('e-btn-bd-red-lg'); $target.find('.e-btn-bd-red-video-xl').addClass('e-btn-bd-black-video-xl').removeClass('e-btn-bd-red-video-xl'); $target.find('.e-btn-bd-red-video-lg').addClass('e-btn-bd-black-video-lg').removeClass('e-btn-bd-red-video-lg'); } else { $target.find('a').each(function (index, elm) { $(this).attr('class', _this.aClassArr[index]); }) } }, 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.moduleSlideObj = $target.find(".swiper-slide"); this.moduleSlideObj.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-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(); } }, initSwiper: function () { var _this = this; var slideLength = $target.find(".swiper-slide").length; var mySwiper = new Swiper($target.find(".swiper-container"), { effect: 'fade', fadeEffect: { crossFade: true, }, pagination: { // 设置点点点 el: $target.find('.swiper-pagination'), clickable: true }, grabCursor: slideLength > 1 ? true : false, autoplay: $target.data("auto-time") ? { delay: $target.data("auto-time"), stopOnLastSlide: false, disableOnInteraction: true } : false, loop: slideLength > 1 ? true : false, // 设置自动轮播 noSwiping: slideLength > 1 ? false : true, runCallbacksOnInit: true, on: { init: function () { $target.find(".swiper-pagination").show(); }, slideChangeTransitionEnd: function () { _this.activeIndex = this.activeIndex; setTimeout(function () { // 执行文字动画 if (_this.animateOff) { if (_this.winw > 1200) { $target.find(".swiper-slide").eq(mySwiper.activeIndex).addClass('animate').siblings().removeClass('animate'); } else { $target.find(".swiper-slide").addClass('animate'); } } // 根据文字颜色变化底部点点点的颜色 var $currentSilde = $target.find(".swiper-slide-active"); var $pr = $currentSilde.parent(); if ($currentSilde.hasClass('isBlackFont')) { $pr.next('.swiper-pagination').addClass('gray'); } else { $pr.next('.swiper-pagination').removeClass('gray'); } }, 0) }, resize: function () { var _this = this; setTimeout(function () { _this.update(); //窗口变化时,更新Swiper的一些属性,如宽高等 _this.emit('slideChangeTransitionEnd'); }, 250) }, } }); //鼠标覆盖停止自动切换 mySwiper.el.onmouseover = function () { mySwiper.autoplay.stop(); } //鼠标离开开始自动切换 mySwiper.el.onmouseout = function () { mySwiper.autoplay.start(); } }, scrollEvent: function () { var _this = this; _this.win.on('scroll.202208150943', function () { // 获取位置 _this.scrollTop = _this.win.scrollTop(); _this.moduleTop = $target.offset().top; _this.judgmentHomeOther(); // 判断是否是首页,还是内页。如果是首页pc就执行动画,其他的不用执行 _this.lazyVideoLink(); // 视频是否加载 _this.lazyPicLink(); // 视频是否图片 }); }, resizeEvent: function () { // 页面resize事件 var _this = this; var resizeWinw = 0; var resizeTimer = ''; this.win.on('resize.202208150943', function () { var winw = _this.win.width(); if (winw != resizeWinw) { currentWinw = winw; // 删除之前的定时器 if (resizeTimer) { clearTimeout(resizeTimer); } // 添加新的定时器 resizeTimer = setTimeout(function () { _this.resizeInit(); // resize初始化 _this.setWapBtnColor(); // 设置按钮颜色 _this.judgmentHomeOther(); // 判断是否是首页,还是内页。如果是首页pc就执行动画,其他的不用执行 _this.scrollEvent(); // 设置滚动事件,文字动画效果 }, 200) } }) } }; module202208150943Obj.init(); } // 初始化 $('.e-module-202208150943').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202208150943Fun($(this)); }) } // 合作伙伴 if ($('.e-module-202305251344').length > 0) { function module202305251344Fun($target) { var module202305251344Obj = { init: function () { // 获取属性 this.win = $(window); this.moduleObj = $target; this.resizeInit(); this.judgmentPcWap(); this.resizeEvent(); this.lazyPicLink(); this.scrollEvent(); }, resizeInit: function () { this.winw = this.win.width(); this.winh = this.win.height(); // 获取位置 this.scrollTop = this.win.scrollTop(); this.moduleTop = this.moduleObj.offset().top; }, judgmentPcWap: function () { this.clickEvent(); }, 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); $this.parent().addClass("over").css({ "height": "auto", "background": "none" }) } }) } }, scrollEvent: function () { var _this = this; _this.win.on('scroll.202305251344', function () { // 获取位置 _this.scrollTop = _this.win.scrollTop(); _this.moduleTop = _this.moduleObj.offset().top; _this.lazyPicLink(); // 视频是否图片 }); }, clickEvent: function () { var _this = this; // 获取对象 var closeBtn = this.moduleObj.find('.close-btn'); var point = this.moduleObj.find('.partner-item .imgs'); var popCons = this.moduleObj.find('.partner-item .pop-cons'); var popCon = this.moduleObj.find('.partner-item .pop-con'); point.on('click', function () { $('body').append($(this).parent().find('.pop').clone()).find('>.pop').show(); }) $('body').on('click', ".pop-cons", function () { $('body').find('>.pop').remove(); }) $('body').on('click', '.close-btn', function () { $('body').find('>.pop').remove(); }) $('body').on('click', '.pop-con', function (e) { e.stopPropagation(); }) // $('body').on('mouseup', function (e) { // if (!popCon.is(e.target) && popCon.has(e.target).length == 0) { // $('body').find('>.pop').remove(); // } // }) }, resizeEvent: function () { // 页面resize事件 var _this = this; var resizeWinw = 0; var resizeTimer = ''; this.win.on('resize.202209070955', function () { var winw = _this.win.width(); if (winw != resizeWinw) { currentWinw = winw; // 删除之前的定时器 if (resizeTimer) { clearTimeout(resizeTimer); } // 添加新的定时器 resizeTimer = setTimeout(function () { _this.resizeInit(); // resize初始化 _this.judgmentPcWap(); // 判断移动还是pc端 }, 100) } }) } }; module202305251344Obj.init(); } // 初始化 $('.e-module-202305251344').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202305251344Fun($(this)); }) } //金句 if ($('.e-module-202306011432').length > 0) { function module202306011432Fun($target) { var module202306011432Obj = { 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(); } }, 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) // } // }) 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); $this.parent().addClass("over").css({ "height": "auto", "background": "none" }) } }) } }, initSwiper: function () { var _this = this; var slideLength = $target.find(".swiper-slide").length; if (slideLength > 3) { var mySwiper = new Swiper($target.find(".swiper"), { watchOverflow: true, // 一屏不显示左右箭头以及pagination spaceBetween: 20, // 板块与板块之间的间距 slidesPerView: 1.1, //没屏幕显示的个数 resistanceRatiao: 1, //触底不反弹 autoplay: false, centeredSlides: true, loop: true, // 设置自动轮播 // 如果需要前进后退按钮 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.2, autoplay: false, spaceBetween: -10, autoplay: false, }, 992: { slidesPerView: 2.2, autoplay: false, spaceBetween: -20, resistanceRatiao: 1, //触底不反弹 autoplay: false, }, 768: { slidesPerView: 1, autoplay: false, spaceBetween: 0, resistanceRatiao: 1, //触底不反弹 autoplay: false, }, }, on: { init: function () { if (_this.winw < 992) { setTimeout(function () { $target.find(".li").height($target.find('.z_cc').height()); }, 500) } }, resize: function () { var This = this; setTimeout(function () { This.emit('init'); This.update(); //窗口变化时,更新Swiper的一些属性,如宽高等 }, 150) }, } }); } else { var mySwiper = new Swiper($target.find(".swiper"), { watchOverflow: true, // 一屏不显示左右箭头以及pagination spaceBetween: 20, // 板块与板块之间的间距 slidesPerView: 1.1, //没屏幕显示的个数 resistanceRatiao: 1, //触底不反弹 autoplay: false, centeredSlides: true, loop: true, // 设置自动轮播 // 如果需要前进后退按钮 navigation: { nextEl: $target.find('.swiper-button-next'), prevEl: $target.find('.swiper-button-prev'), }, pagination: { // 设置点点点 el: $target.find('.swiper-pagination'), type: "fraction", }, breakpoints: { 1200: { slidesPerView: 2.8, autoplay: false, spaceBetween: -10, autoplay: false, }, 992: { slidesPerView: 2.2, autoplay: false, spaceBetween: -20, resistanceRatiao: 1, //触底不反弹 autoplay: false, }, 768: { slidesPerView: 1, autoplay: false, spaceBetween: 0, resistanceRatiao: 1, //触底不反弹 autoplay: false, }, }, on: { init: function () { if (_this.winw < 992) { setTimeout(function () { $target.find(".li").height($target.find('.z_cc').height()); }, 500) } }, resize: function () { var This = this; setTimeout(function () { This.emit('init'); This.update(); //窗口变化时,更新Swiper的一些属性,如宽高等 }, 150) }, } }); } }, scrollEvent: function () { var _this = this; _this.win.on('scroll.202306011432', 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.202306011432', 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) } }) } }; module202306011432Obj.init(); } // 初始化 $('.e-module-202306011432').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202306011432Fun($(this)); }) } $(window).on("scroll.scrollBottomTopAnimeta", function () { if (off) { off = false animateInit(); } scrollBottomTopAnimeta(); }); // 页面滚动动画:初始化 var animateInitsetTimeout = ''; var translateY1Obj = ''; var off = true; // 页面滚动动画:下到上 function scrollBottomTopAnimeta() { if (winW > 992) { scrollTop = $(window).scrollTop(); for (var i = 0; i < boxTopAll.length; i++) { if (boxTopAll[i] < winH + scrollTop) { var topNum = numLine[i] + (boxTopAll[i] - winH - scrollTop); if (topNum < 2) { topNum = 0; } translateY1Obj.eq(i).css({ "transform": "translateY(" + topNum + "px)", "opacity": 1 - topNum / numLine[i] }); } } } } function animateInit() { translateY1Obj = $('.translateY1'); if (winW > 992) { // 计算所有动画的位置 numLine = []; boxTopAll = []; winH = $(window).height(); // 初始化动画位置 translateY1Obj.each(function () { var _this = $(this); var num = _this.data('line') ? _this.data('line') : 200; numLine.push(num); _this.css("transform", "translateY(" + num + "px)"); }) clearTimeout(animateInitsetTimeout); animateInitsetTimeout = setTimeout(function () { translateY1Obj.each(function () { var _this = $(this); var num = _this.data('line') ? _this.data('line') : 200; boxTopAll.push(_this.parent().offset().top + num); }) scrollBottomTopAnimeta(); }, 400) } else { translateY1Obj.css("transform", "translateY(0px)"); } } animateInit(); })