$(function () { // 导航 $("#mob-menubtn").on("click", function () { $('.main-header').addClass('open'); $('#close-menubtn').show(); $('#mob-menubtn').hide(); $('.guide').hide(); // $('.nav-new').addClass('active') $('body').css('overflow', 'hidden') // $('.logo img').attr('src', 'https://e.huawei.com/topic/sitecore/2023-mwc/img/banner/logo_huawei.png'); }) $("#close-menubtn").on("click", function () { closeMenu() }) //mob端关闭导航 function closeMenu() { $('.main-header').removeClass('open'); $('#close-menubtn').hide(); $('#mob-menubtn').show(); $('.guide').show(); $('body').css('overflow', 'auto') } // 定位导航 function fixedNav() { // 基础对象 var winW = $(window).width(); // 对象 var navObj = $('.bz-header'); var liObj = navObj.find('.li'); var boxObj = $('.anchorpoint'); // 锚点定位,如果链接有带参数,自动触发点击事件 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 - 65)); }) // 获取当前可预览的板块在哪个位置 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 - 65); // 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(); var $backtop = $(".backtop"); var $slide = $('.slidebars'); $(window).on('scroll.backtop', function () { var high = $(window).scrollTop(); var bannerH = $('.e-module-202312151534').height(); var invitH = $('.e-module-202312191038').height(); var $high = '' if ($('.e-module-202312151534').length > 0) { $high = bannerH; } else { $high = invitH; } // console.log(invitH) if (high > $high) { $('.xiazai').addClass('active'); setTimeout(() => { $('.xiazai').addClass('hide'); $('.slidebars').addClass('active'); }, 5000); } high >= 700 ? $slide.fadeIn() : $slide.fadeOut(); }) $backtop.on('click', function () { $("html, body").animate({ scrollTop: 0 }); }) // banner if ($('.e-module-202312151534').length > 0) { function module202312151534Fun($target) { var module202312151534Obj = { init: function () { // 获取属性 this.win = $(window); this.bannerObj = $target; // this.bannerObj = $target.find('.e-module-202312151534'); this.headerObj = $('.bz-header'); this.blackNavObj = $('.e-module-202208180950'); // this.cookieObj = $('.e-module-202208270930'); this.bannerWrapObj = this.bannerObj.find('.banner-wrap'); this.bannerSlideObj = this.bannerObj.find(".swiper-slide"); this.bannerBg = this.bannerObj.find('.banner-bg'); this.bannerText = this.bannerObj.find('.text'); this.bannerKV = this.bannerObj.find('.wap-kv') // 创建变量 this.opacityValue = 0; this.currentLastPostion = 0; // 调用函数 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 { // 添加视频 // $('body').css('overflow', 'hidden'); // setTimeout(() => { // $('.open-screen').fadeOut(); // this.addVideoLink(this.bannerObj.find('.e-bg')); // if (this.winw > 1200) { // this.setTextTime(); // } // $('body').css('overflow', 'visible'); // }, 3000); this.addVideoLink(this.bannerObj.find('.e-bg')); // 执行页面加载动画 this.bannerSlideObj.addClass('animate'); } this.setVideoCenterShow(); // 视频居中显示 this.scrollEvent(); // 滚动条事件 this.clickEvent(); // 点击关闭顶部的cookie声明,重新计算banner高度 if (this.winw > 1200) { this.setTextTime(); } else { if (this.bannerBg.find('img').src != '') { $('.open-screen').fadeOut(); } } this.resizeEvent(); }, resizeInit: function () { this.winh = this.win.height(); this.winw = this.win.width(); this.unitLength = this.winh / 100; this.headerObjH = this.headerObj.height(); }, setBannerHeight: function () { // 如果cookie条关闭了,直接banner置顶,这样解决了页面往下滚动的时候,文字跳动的情况。 if (this.winw > 992) { this.bannerObj.height(parseInt(this.winh)) this.bannerWrapObj.css({ 'height': parseInt(this.winh), }); } // var textH = this.bannerText.height() + 40; // var kvH = parseInt(this.winh) - textH // this.bannerKV.css({ // 'height':kvH // }) }, 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' }) } }, addVideoLink: function (bgObj) { if (bgObj.data('src') != undefined && bgObj.data('src') != '' && this.winw > 1200) { // 添加video的dom结构 if (bgObj.find('.video').length == 0) { bgObj.append(""); } $('.open-screen').fadeOut(); // 判断视频是否已经赋值,如果赋值了,就不需要再次赋值了。 var videoObj = bgObj.find('.video'); if (videoObj.attr("src") != bgObj.data('src')) { videoObj.attr("src", bgObj.data('src')); } } else { bgObj.find('.video').remove(); } }, clickEvent: function () { }, scrollEvent: function () { var _this = this; this.win.on('scroll.202312151534', function () { // 获取滚动条位置 var t = _this.win.scrollTop(); }) }, setTextTime: function () { var videoObj = $(".e-module-202312151534 .video")[0]; // 获取视频对象 var videoCurrentTime = 0; // 获取视频播放到第几秒 var loopStart = 5; // 无限轮播开始时间 var loopEnd = 11; // 无限轮播结束时间 // 开启监听定时器 var aaa = setInterval(function () { // 获取视频播放到第几秒 videoCurrentTime = Math.round(videoObj.currentTime); // 设置视频无限轮播的范围 if (videoCurrentTime == loopEnd) { videoObj.currentTime = loopStart; } // 显示视频 if (videoCurrentTime == loopStart && $(".e-module-202312151534 .video-box").length > 0) { $(".e-module-202312151534 .video-box .vedioplay").fadeIn(); // 添加视频遮罩 $(".e-module-202312151534 .e-box").prepend("
"); $(".e-module-202312151534 .masking").css({ position: "absolute", left: 0, top: 0, width: "100%", height: "100%", background: "#fff", opacity: .4 }) } if (videoCurrentTime == loopStart) { $(".e-module-202312151534").addClass("animate-v2"); } }, 1000); }, initSwiper: function () { var _this = this; var $target = this.bannerObj; 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, // 设置成true,会触发一次on事件里面的slideChangeTransitionStart函数的调用 on: { init: function () { if (slideLength > 1) { $target.find(".swiper-pagination").show(); } $target.find(".swiper-slide").addClass('animate'); }, transitionStart: function () { // 设置轮播器当前页和前后两页的图片、视频的懒加载 var $currentSilde = $target.find(".swiper-slide-active"); var $prevSilde = $target.find(".swiper-slide-prev"); var $nextSilde = $target.find(".swiper-slide-next"); $currentSilde.add($prevSilde).add($nextSilde).find("img").each(function () { var $this = $(this); var src = $this.attr("data-original"); if ($this.parents(".e-bg").css("backgroundImage") != "url(" + src + ")") { $this.parents(".e-bg").css("backgroundImage", "url('" + src + "')"); $this.parents(".e-lazy").css("display", "none"); } _this.addVideoLink($this.parents(".e-bg")); }); }, slideChangeTransitionEnd: function () { setTimeout(function () { // 执行文字动画 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('transitionStart'); _this.emit('slideChangeTransitionEnd'); }, 250) }, } }); }, 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插件。多个就加载 if (_this.bannerSlideObj.length == 1) { // 添加视频 _this.addVideoLink(_this.bannerObj.find('.e-bg')); // 执行页面加载动画 _this.bannerSlideObj.addClass('animate'); } _this.setVideoCenterShow(); // 视频居中显示 _this.scrollEvent(); // 滚动条事件 _this.clickEvent(); // 点击关闭顶部的cookie声明,重新计算banner高度 }, 200) } }) } } module202312151534Obj.init(); } // 初始化 $('.e-module-202312151534').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202312151534Fun($(this)); }) } // practices if ($('.e-module-202312191652').length > 0) { function module202312191652Fun($target) { var module202312191652Obj = { init: function () { this.win = $(window); this.moduleObj = $target; this.tabList = $target.find('.tab'); this.tabCon = $target.find('.tabitem'); // 数组存储swiper对象 this.swiper = {}; this.resizeInit(); this.clickEvent(); // tab点击事件 if (this.winw > 992) { this.initSwiper(this.tabCon.eq(0), 0); // 执行swiper,默认执行第一个tab下面的con轮播器 if (this.tabCon.eq(0).find('swiper-slide').length > 2) { this.tabCon.eq(0).find(".swiper-pagination").show(); } else { this.tabCon.eq(0).find(".swiper-pagination").hide(); } } else { // this.initSwiper(this.tabCon.eq(0), 0); // this.initSwiper(this.tabCon.eq(1), 1); // this.initSwiper(this.tabCon.eq(2), 2); for (var i = 0; i < 3; i++) { this.initSwiper(this.tabCon.eq(i), i); if (this.winw > 750) { if (this.tabCon.eq(i).find('.swiper-slide').length > 2) { this.tabCon.eq(i).find(".swiper-pagination").show(); } else { this.tabCon.eq(i).find(".swiper-pagination").hide(); } } else { if (this.tabCon.eq(i).find('.swiper-slide').length > 1) { this.tabCon.eq(i).find(".swiper-pagination").show(); } else { this.tabCon.eq(i).find(".swiper-pagination").hide(); } } } } this.resizeEvent(); }, resizeInit: function () { this.winw = this.win.width(); }, clickEvent: function () { var _this = this; _this.tabList.on('click', function () { var $this = $(this); var _index = $this.index(); $this.addClass('active').siblings().removeClass('active'); _this.tabCon.eq(_index).addClass('active').siblings().removeClass('active'); var length = _this.tabCon.eq(_index).find('swiper-slide').length if (this.winw > 992) { if (length > 2) { _this.tabCon.eq(_index).find(".swiper-pagination").show(); } else { _this.tabCon.eq(_index).find(".swiper-pagination").hide(); } } if (_this.winw > 992) { _this.initSwiper(_this.tabCon.eq(_index), _index); // 点击当前tab执行当前tab下面的con的swiper } }); }, initSwiper: function ($this, index) { var _this = this; // 防止swiper文件被执行2次。 // if ($this.data('init')) { // this.swiper[index].update(); // resize初始化 // return; // } $this.data('init', true); var slideLength = $this.find(".swiper-slide").length; var mySwiper = new Swiper($this.find(".swiper"), { slidesPerView: 1, spaceBetween: 20, resistanceRatiao: 1, //触底不反弹 watchOverflow: true, //一屏显示左右按钮和pag pagination: { el: $this.find('.swiper-pagination'), // type: "progressbar", clickable: true, }, //大于分辨率 breakpoints: { 1600: { slidesPerView: 2, spaceBetween: 40, }, 992: { slidesPerView: 2, spaceBetween: 30, }, 768: { slidesPerView: 2, spaceBetween: 20, } }, on: { init: function () { if (slideLength > 2) { $this.find(".swiper-pagination").show(); } else { $this.find(".swiper-pagination").hide(); } }, resize: function () { var _swiper = this; setTimeout(function () { _swiper.update(); //窗口变化时,更新Swiper的一些属性,如宽高等 if (slideLength > 2) { $this.find(".swiper-pagination").show(); } else { $this.find(".swiper-pagination").hide(); } }, 250) } }, }); this.swiper[index] = mySwiper; }, resizeEvent: function () { // 页面resize事件 var _this = this; var resizeWinw = 0; var resizeTimer = ''; this.win.on('resize.202312191652', function () { var winw = _this.win.width(); if (winw != resizeWinw) { currentWinw = winw; // 删除之前的定时器 if (resizeTimer) { clearTimeout(resizeTimer); } // 添加新的定时器 resizeTimer = setTimeout(function () { _this.resizeInit(); }, 200) } }) } }; module202312191652Obj.init(); }; $('.e-module-202312191652').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202312191652Fun($(this)); }); } // story if ($('.e-module-202312211021').length > 0) { function module202312211021Fun($target) { var module202312211021Obj = { 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初始化 if (this.winw > 992) { 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 = 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('.next'), prevEl: $target.find('.prev'), }, breakpoints: { // 最小屏幕 1200: { slidesPerView: 3, spaceBetween: 40, }, 992: { slidesPerView: 3, 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.202312211021', 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.202312211021', 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) } }) } }; module202312211021Obj.init(); } // 初始化 $('.e-module-202312211021').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202312211021Fun($(this)); }) } // event if ($('.e-module-202312211402').length > 0) { function module202312211402Fun($target) { var module202312211402Obj = { init: function () { // 获取属性 this.win = $(window); this.bannerObj = $target; // 创建变量 this.opacityValue = 0; this.currentLastPostion = 0; // 调用函数 this.resizeInit(); // 需要rezise的变量 // 添加视频 this.addVideoLink(this.bannerObj.find('.e-bg')); // this.setVideoCenterShow(); // 视频居中显示 this.scrollEvent(); // 滚动条事件 this.clickEvent(); // 点击关闭顶部的cookie声明,重新计算banner高度 this.resizeEvent(); }, resizeInit: function () { this.winh = this.win.height(); this.winw = this.win.width(); this.unitLength = this.winh / 100; }, 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' }) } }, 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(); } }, clickEvent: function () { }, scrollEvent: function () { var _this = this; this.win.on('scroll.202312211402', function () { // 获取滚动条位置 var t = _this.win.scrollTop(); }) }, 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.addVideoLink(_this.bannerObj.find('.e-bg')); // _this.setVideoCenterShow(); // 视频居中显示 _this.scrollEvent(); // 滚动条事件 _this.clickEvent(); // 点击关闭顶部的cookie声明,重新计算banner高度 }, 200) } }) } } module202312211402Obj.init(); } // 初始化 $('.e-module-202312211402').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202312211402Fun($(this)); }) } // speaker if ($('.e-module-202401161427').length > 0) { function module202401161427Fun($target) { var module202401161427Obj = { 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) }, } }); //鼠标覆盖停止自动切换 mySwiper.el.onmouseover = function () { mySwiper.autoplay.stop(); } //鼠标离开开始自动切换 mySwiper.el.onmouseout = function () { mySwiper.autoplay.start(); } }, scrollEvent: function () { var _this = this; _this.win.on('scroll.202401161427', 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.202401161427', 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) } }) } }; module202401161427Obj.init(); } // 初始化 $('.e-module-202401161427').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202401161427Fun($(this)); }) } // agenda if ($('.e-module-202401161556').length > 0) { function module202401161556Fun($target) { var module202401161556Obj = { init: function () { // 获取属性 this.win = $(window); this.moduleObj = $target; this.tab = $target.find(".tab"); this.agendaBot = $target.find('.agenda-bottom'); this.listItem = $target.find('.list-item'); this.closePop = $target.find('.close-btn'); this.popCon = $target.find('.pop-con'); this.sum1 = this.agendaBot.find('.summit .day1').length; this.sum2 = this.agendaBot.find('.summit .day2').length; this.ses1 = this.agendaBot.find('.session .day1').length; this.ses2 = this.agendaBot.find('.session .day2').length; this.forum1 = this.agendaBot.find('.forum .day1').length; this.forum2 = this.agendaBot.find('.forum .day2').length; this.filSel = $target.find('.fil-sel'); // 判断按钮是否存在 if ($(".e-module-202401161556 .btn").length > 0) { $(".agenda-item-con .item-time").hide(); $(".agenda-item-con").css("justify-content", "space-between"); } this.resizeInit(); // resize初始化 this.addHtml(); 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; }, 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) } }) } }, clickEvent: function () { var _this = this; _this.tab.click(function () { var $this = $(this); if ($this.parent(".tablist").hasClass("preventClick")) { return; } var _index = $this.index(); $this.addClass('active').siblings().removeClass('active'); if (_index == 0) { _this.agendaBot.find('.day1').show(); _this.agendaBot.find('.day2').hide(); if (_this.sum1 == 0) { _this.agendaBot.find('.summit').hide(); } else { _this.agendaBot.find('.summit').show(); } if (_this.ses1 == 0) { _this.agendaBot.find('.session').hide(); } else { _this.agendaBot.find('.session').show(); } if (_this.forum1 == 0) { _this.agendaBot.find('.forum').hide(); } else { _this.agendaBot.find('.forum').show(); } } else { _this.agendaBot.find('.day2').show(); _this.agendaBot.find('.day1').hide(); if (_this.sum2 == 0) { _this.agendaBot.find('.summit').hide(); } if (_this.ses2 == 0) { _this.agendaBot.find('.session').hide(); } if (_this.forum2 == 0) { _this.agendaBot.find('.forum').hide(); } } }) _this.listItem.on('click', function () { if ($(".palyVideo").length > 0) { $(".palyVideo").removeClass("palyVideo"); return; } $('body').append($(this).find('.agenda-item-pop').clone()).find('>.agenda-item-pop').show().addClass("pop-box"); $(".agenda-item-pop.pop-box .item-time").show(); // 调整按钮结构 var str = $(".agenda-item-pop.pop-box .btn").hide().clone().show(); // console.log(str) $(".agenda-item-pop.pop-box .item-pop-cons .item-pop-con .agenda-item-con .item-title").append(str); }) $('body').on('click', ".item-pop-cons", function () { $('body').find('>.agenda-item-pop').remove(); }) $('body').on('click', '.item-close-btn', function () { $('body').find('>.agenda-item-pop').remove(); }) $('body').on('click', '.item-pop-con,.btn', function (e) { e.stopPropagation(); }) $(".e-module-202401161556 .btn").on('click', function (e) { $(this).addClass("palyVideo"); }) // 筛选点击列表 _this.filSel.click(function () { $(this).parent().toggleClass('active'); $(this).parent().siblings().removeClass('active') }) // 筛选 _this.moduleObj.find(".filter .filter-cont .filter-item .fil-list ul li").on("click", function () { _this.moduleObj.find(".age-tit").hide(); _this.moduleObj.find(".agenda-box").hide(); _this.moduleObj.find(".list-item").hide(); var str = $(this).data("type"); _this.moduleObj.find('.current-filter').css('display', 'flex').find(".cur-filter-p2").text(str); if (_this.winw > 992) { _this.moduleObj.find(".filter-item").removeClass('active'); } else { _this.moduleObj.find(".filter-content-list").hide(); $(this).addClass('active').siblings().removeClass('active'); } _this.moduleObj.find(".list-item").each(function () { if ($(this).data("type") == str) { $(this).show(); $(this).parents(".agenda-box").show().find(".age-tit").show(); $(this).find('.item-time').addClass('active') } }) _this.moduleObj.find(".tablist").addClass("preventClick"); _this.tab.removeClass('active') // console.log($(this).data("type")) }) // 清除当前筛选 _this.moduleObj.find('.current-filter-close').on('click', function () { _this.moduleObj.find(".tablist").removeClass("preventClick"); _this.moduleObj.find('.current-filter').hide(); _this.moduleObj.find(".age-tit").show(); _this.moduleObj.find(".agenda-box").show(); _this.moduleObj.find(".list-item").show(); _this.tab.eq(0).addClass('active').siblings().removeClass('active'); _this.moduleObj.find('.item-time').removeClass('active') _this.agendaBot.find('.day1').show(); _this.agendaBot.find('.day2').hide(); }) //wap 筛选 _this.moduleObj.find('.filter-wap').on('click', function () { $(this).parent().find('.filter-content-list').show(); _this.moduleObj.find(".filter-item").eq(0).addClass('active').siblings().removeClass('active'); }) // wap筛选关闭 _this.moduleObj.find('.filter-popup .iconfont').on('click', function () { $(this).parents('.filter-content-list').hide(); }) }, addHtml: function () { var _this = this; var box = this.moduleObj.find(".yc-list .list-item"); box.each(function (index) { var popBox = '
' + $(this).find('.agenda-item-con').html() + '
'; $(this).find('.item-pop-con .item-close-btn').after(popBox); if ($(this).find('.icon-dates img').data('xl') != '') { $(this).find('.icon-dates img').attr('src', $(this).find('.icon-dates img').data('xl')) } if ($(this).find('.icon1 img').data('xl') != '') { $(this).find('.icon1 img').attr('src', $(this).find('.icon1 img').data('xl')) } if ($(this).find('.icon2 img').data('xl') != '') { $(this).find('.icon2 img').attr('src', $(this).find('.icon2 img').data('xl')) } if ($(this).find('.icon3 img').data('xl') != '') { $(this).find('.icon3 img').attr('src', $(this).find('.icon3 img').data('xl')) } }) }, scrollEvent: function () { var _this = this; _this.win.on('scroll.202401161556', 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.202401161556', function () { var winw = _this.win.width(); if (winw != resizeWinw) { currentWinw = winw; // 删除之前的定时器 if (resizeTimer) { clearTimeout(resizeTimer); } // 添加新的定时器 resizeTimer = setTimeout(function () { _this.resizeInit(); // resize初始化 _this.scrollEvent(); // 设置滚动事件,文字动画效果 }, 100) } }) } }; module202401161556Obj.init(); } // 初始化 $('.e-module-202401161556').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202401161556Fun($(this)); }) } // booth if ($('.e-module-202401261643') && $('.e-module-202401261643').length > 0) { $('.e-module-202401261643').each(function () { var _this = $(this) var winW = $(window).width(); var lookFullBtn = $('.full-img'); var viewBox = _this.find('.view-box'); var closeFull = _this.find('.view-box .close-full'); lookFullBtn.on('click', function () { viewBox.fadeIn(400); $('body').css('overflow', 'hidden') var startX, endX, scale, x1, x2, y1, y2, imgLeft, imgTop, imgWidth, imgHeight, one = false, $touch = $(".view-box img"), //选择放大缩小的元素 originalWidth = $touch.width(), originalHeight = $touch.height(), baseScale = parseFloat(originalWidth / originalHeight), imgData = [], bgTop = parseInt($(".view-box img").css('top')); function siteData(name) { imgLeft = parseInt(name.css('left')); imgTop = parseInt(name.css('top')); imgWidth = name.width(); imgHeight = name.height(); } $(document).on('touchstart touchmove touchend', $(".view-box img"), function (event) { var $me = $(".view-box img"); touch1 = event.originalEvent.targetTouches[0], // 第一根手指touch事件 touch2 = event.originalEvent.targetTouches[1], // 第二根手指touch事件 fingers = event.originalEvent.touches.length; // 屏幕上手指数量 //手指放到屏幕上的时候,还没有进行其他操作 if (event.type == 'touchstart') { if (fingers == 2) { // 缩放图片的时候X坐标起始值 startX = Math.abs(touch1.pageX - touch2.pageX); one = false; } else if (fingers == 1) { x1 = touch1.pageX; y1 = touch1.pageY; one = true; } //siteData($me); } //手指在屏幕上滑动 else if (event.type == 'touchmove') { if (fingers == 2) { // 缩放图片的时候X坐标滑动变化值 endX = Math.abs(touch1.pageX - touch2.pageX); scale = endX - startX; $me.css({ 'width': originalWidth + scale, //'height': originalWidth + scale  //如果图片被拉伸了可以把这句去掉,让图片自适应 }); } else if (fingers == 1) { x2 = touch1.pageX; y2 = touch1.pageY; if (one) { $me.css({ 'left': imgLeft + (x2 - x1), 'top': imgTop + (y2 - y1) }); } } } //手指移开屏幕 else if (event.type == 'touchend') { // 手指移开后保存图片的宽 originalWidth = $touch.width(), siteData($me); imgData = [ [imgLeft, imgTop - bgTop, imgWidth, imgHeight], [0, 0, 640, 640] ]; } }); var getData = function () { return imgData; }; return { imgData: getData } }) closeFull.on('click', function () { viewBox.fadeOut(400) $('body').css('overflow', 'auto') }) }) } // new launch if ($('.e-module-202309011037').length > 0) { function module202309011037Fun($target) { var module202309011037Obj = { init: function () { // 获取属性 this.win = $(window); this.moduleObj = $target; this.moduleWrapperObj = this.moduleObj.find(".swiper-wrapper"); this.moduleSlideObj = this.moduleObj.find(".swiper-slide"); this.tabUl = this.moduleObj.find('.tablist'); this.tabLi = this.moduleObj.find('.tablist li'); this.tabCon = this.moduleObj.find('.tab-itemcon'); // 数组存储swiper对象 this.swiper = {}; this.resizeInit(); // resize初始化 this.scrollEvent(); // 设置滚动事件,文字动画效果 this.clickEvent(); // 点击事件 if (this.winw > 992) { this.initSwiper(this.tabCon.eq(0), 0); // 执行swiper,默认执行第一个tab下面的con轮播器 } 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) { // 当滚动条滚动到当前位置时,加载视频 this.moduleSlideObj = this.moduleObj.find(".e-lazy"); 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) } }) } }, clickEvent: function () { var _this = this; _this.tabLi.on('click', function () { var $this = $(this); var _index = $this.index(); $this.addClass('active').siblings().removeClass('active'); _this.tabCon.eq(_index).show().siblings().hide(); if (_this.winw > 992) { _this.initSwiper(_this.tabCon.eq(_index), _index); // 点击当前tab执行当前tab下面的con的swiper } }); _this.tabLi.eq(0).trigger('click'); _this.moduleSlideObj.find('.swiper-detail-div').on('click', function () { var This = $(this); $('body').append($(this).find('.launch-detail-pop').clone()).find('>.launch-detail-pop').show(); $('body').css('overflow', 'hidden'); }) $('body').on('click', ".launch-detail-popcons", function () { $('body').find('>.launch-detail-pop').remove(); $('body').css('overflow', 'auto'); }) $('body').on('click', '.detail_close_btn', function () { $('body').find('>.launch-detail-pop').remove(); $('body').css('overflow', 'auto'); }) $('body').on('click', '.launch-detail-popcon', function (e) { e.stopPropagation(); }) function getUrlParam(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)") var r = window.location.search.substr(1).match(reg) if (r != null) return unescape(r[2]); return null } if (getUrlParam('type') == null) { _this.tabLi.eq(0).addClass('active') _this.tabCon.eq(0).show().siblings().hide(); if (_this.winw > 992) { _this.initSwiper(_this.tabCon.eq(0), 0); // 点击当前tab执行当前tab下面的con的swiper } } if (getUrlParam('section') == 'whitepaper') { _this.tabLi.eq(2).addClass('active').siblings().removeClass('active') _this.tabCon.eq(2).show().siblings().hide(); if (_this.winw > 992) { _this.initSwiper(_this.tabCon.eq(2), 2); // 点击当前tab执行当前tab下面的con的swiper } } for (var i = 0; i < _this.tabLi.length; i++) { if (_this.tabLi.eq(i).attr('data-key') == getUrlParam('type')) { _this.tabLi.eq(i).addClass('active').siblings().removeClass('active') _this.tabCon.eq(i).show().siblings().hide(); if (_this.winw > 992) { _this.initSwiper(_this.tabCon.eq(i), i); // 点击当前tab执行当前tab下面的con的swiper } } } }, initSwiper: function ($this, index) { var _this = this; // 防止swiper文件被执行2次。 if ($this.data('init')) { this.swiper[index].update(); // resize初始化 return; } $this.data('init', true); var slideLength = $this.find(".swiper-slide").length; var mySwiper = new Swiper($this.find(".swiper"), { slidesPerView: 1, spaceBetween: 20, resistanceRatiao: 0.5, //触底不反弹 slidesPerGroup: 1, pagination: { el: $this.find('.swiper-pagination'), clickable: true, }, // 如果需要前进后退按钮 // navigation: { // nextEl: $this.find('.swiper-button-next'), // prevEl: $this.find('.swiper-button-prev'), // }, //大于分辨率 breakpoints: { 1600: { slidesPerView: 4, spaceBetween: 40, slidesPerGroup: 4, }, 1200: { slidesPerView: 4, spaceBetween: 30, slidesPerGroup: 4, }, 992: { slidesPerView: 3, spaceBetween: 20, slidesPerGroup: 3, }, 768: { slidesPerView: 2, slidesPerGroup: 2, } }, on: { init: function () { if (slideLength > 4 && _this.winw > 992) { $this.find(".swiper-pagination").show(); } else { $this.find(".swiper-pagination").hide(); $this.find(".swiper-button").hide(); } }, resize: function () { var _swiper = this; setTimeout(function () { _swiper.update(); //窗口变化时,更新Swiper的一些属性,如宽高等 if (slideLength > 3 && _this.winw > 992) { $this.find(".swiper-pagination").show(); } else { $this.find(".swiper-pagination").hide(); } }, 250) } }, }); this.swiper[index] = mySwiper; }, scrollEvent: function () { var _this = this; _this.win.on('scroll.202309011037', 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.202309011037', function () { var winw = _this.win.width(); if (winw != resizeWinw) { currentWinw = winw; // 删除之前的定时器 if (resizeTimer) { clearTimeout(resizeTimer); } // 添加新的定时器 resizeTimer = setTimeout(function () { _this.resizeInit(); // resize初始化 _this.scrollEvent(); // 设置滚动事件,文字动画效果 if (_this.winw > 992) { _this.initSwiper(_this.tabCon.eq(0), 0); // 执行swiper,默认执行第一个tab下面的con轮播器 } }, 100) } }) } }; module202309011037Obj.init(); } // 初始化 $('.e-module-202309011037').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202309011037Fun($(this)); }) } // points if ($('.e-module-202402221408').length > 0) { function module202402221408Fun($target) { var module202402221408Obj = { init: function () { // 获取属性 this.win = $(window); this.moduleObj = $target; this.moduleWrapperObj = this.moduleObj.find(".swiper-wrapper"); this.moduleSlideObj = this.moduleObj.find(".swiper-slide"); this.frontBtn = this.moduleObj.find(".point-avatar"); this.reverseBtn = this.moduleObj.find(".point-text"); // 数组存储swiper对象 this.swiper = {}; this.resizeInit(); // resize初始化 this.scrollEvent(); // 设置滚动事件,文字动画效果 this.clickEvent(); // 点击事件 this.judgmentSwiper(); // 判断需不需要执行swiper 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(".e-lazy"); 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) } }) } }, clickEvent: function () { var _this = this; _this.frontBtn.on('click', function () { if ($(this).hasClass('vedioplay')) { return; } $(this).parent().addClass('filp'); $(this).parents('.swiper-slide').siblings().find('.swiper-con').removeClass('filp') }) _this.reverseBtn.on('click', function () { $(this).parent().removeClass('filp') }) }, initSwiper: function () { var _this = this; var slideLength = $target.find(".swiper-slide").length; var mySwiper = new Swiper($target.find(".swiper"), { slidesPerView: 1, spaceBetween: 20, resistanceRatiao: 0.5, //触底不反弹 slidesPerGroup: 1, watchOverflow: true, //一屏显示左右按钮和pag // autoplay: { // delay: 3000, // stopOnLastSlide: false, // disableOnInteraction: true // }, // loop: true, pagination: { el: $target.find('.swiper-pagination'), clickable: true, }, //大于分辨率 breakpoints: { 1600: { slidesPerView: 4, spaceBetween: 40, slidesPerGroup: 4, }, 1200: { slidesPerView: 4, spaceBetween: 30, slidesPerGroup: 4, }, 992: { slidesPerView: 3, spaceBetween: 20, slidesPerGroup: 3, }, 768: { slidesPerView: 2, slidesPerGroup: 2, } }, on: { init: function () { }, resize: function () { var _swiper = this; setTimeout(function () { _swiper.update(); //窗口变化时,更新Swiper的一些属性,如宽高等 }, 250) } }, }); //鼠标覆盖停止自动切换 // mySwiper.el.onmouseover = function () { // mySwiper.autoplay.stop(); // } //鼠标离开开始自动切换 // mySwiper.el.onmouseout = function () { // mySwiper.autoplay.start(); // } }, scrollEvent: function () { var _this = this; _this.win.on('scroll.202402221408', 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.202402221408', function () { var winw = _this.win.width(); if (winw != resizeWinw) { currentWinw = winw; // 删除之前的定时器 if (resizeTimer) { clearTimeout(resizeTimer); } // 添加新的定时器 resizeTimer = setTimeout(function () { _this.resizeInit(); // resize初始化 _this.scrollEvent(); // 设置滚动事件,文字动画效果 if (_this.winw > 992) { _this.initSwiper(_this.tabCon.eq(0), 0); // 执行swiper,默认执行第一个tab下面的con轮播器 } }, 100) } }) } }; module202402221408Obj.init(); } // 初始化 $('.e-module-202402221408').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202402221408Fun($(this)); }) } // all-in talk if ($('.e-module-202402231406').length > 0) { function module202402231406Fun($target) { var module202402231406Obj = { init: function () { // 获取属性 this.win = $(window); this.moduleObj = $target; this.moduleWrapperObj = this.moduleObj.find(".swiper-wrapper"); this.moduleSlideObj = this.moduleObj.find(".swiper-slide"); this.talkCon = this.moduleObj.find('.talk-container'); this.tablist = this.moduleObj.find('.talk-tablist'); this.tabCon = this.moduleObj.find('.talk-con'); // 数组存储swiper对象 this.swiper = {}; this.resizeInit(); // resize初始化 this.scrollEvent(); // 设置滚动事件,文字动画效果 this.clickEvent(); // 点击事件 this.initSwiper(this.tabCon.eq(0), 0); // 执行swiper,默认执行第一个tab下面的con轮播器 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) { // 当滚动条滚动到当前位置时,加载视频 this.moduleSlideObj = this.moduleObj.find(".e-lazy"); 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) } }) } }, clickEvent: function () { var _this = this; _this.tablist.find('.talk-tab').on('click', function () { var $this = $(this); var _index = $this.index(); $this.addClass('active').siblings().removeClass('active'); _this.tabCon.eq(_index).addClass('active').siblings().removeClass('active'); _this.initSwiper(_this.tabCon.eq(_index), _index); // 点击当前tab执行当前tab下面的con的swiper }); _this.tablist.find('.talk-tab').eq(0).trigger('click'); }, initSwiper: function ($this, index) { var _this = this; // 防止swiper文件被执行2次。 if ($this.data('init')) { this.swiper[index].update(); // resize初始化 return; } $this.data('init', true); var slideLength = $this.find(".swiper-slide").length; var mySwiper = new Swiper($this.find(".swiper"), { slidesPerView: 1, spaceBetween: 20, resistanceRatiao: 1, //触底不反弹 watchOverflow: true, //一屏显示左右按钮和pag slidesPerColumn: 2, slidesPerColumnFill: 'row', pagination: { el: $this.find('.swiper-pagination'), clickable: true, }, //大于分辨率 breakpoints: { 1200: { spaceBetween: 40, slidesPerView: 3, }, 750: { spaceBetween: 20, slidesPerView: 2, }, }, on: { init: function () { }, resize: function () { var _swiper = this; setTimeout(function () { _swiper.update(); //窗口变化时,更新Swiper的一些属性,如宽高等 }, 250) } }, }); this.swiper[index] = mySwiper; }, scrollEvent: function () { var _this = this; _this.win.on('scroll.202402231406', 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.202402231406', function () { var winw = _this.win.width(); if (winw != resizeWinw) { currentWinw = winw; // 删除之前的定时器 if (resizeTimer) { clearTimeout(resizeTimer); } // 添加新的定时器 resizeTimer = setTimeout(function () { _this.resizeInit(); // resize初始化 _this.scrollEvent(); // 设置滚动事件,文字动画效果 _this.initSwiper(_this.tabCon.eq(0), 0); // 执行swiper,默认执行第一个tab下面的con轮播器 }, 100) } }) } }; module202402231406Obj.init(); } // 初始化 $('.e-module-202402231406').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202402231406Fun($(this)); }) } // news if ($('.e-module-202402221527').length > 0) { $('.e-module-202402221527').each(function () { var $target = $('.e-module-202402221527'); if ($target.length > 0) { var item = $target.find('.list-item'); var winw = $(window).width(); var perview = 6; var timer = ''; // 计算speaker数量怎么排版 function countLi(global) { var num = 0; var viewLen = Math.ceil(item.length / global); for (var i = 0; i < viewLen; i++) { $target.find(".swiper-wrapper").prepend( '
'); } item.each(function (i, e) { if (i % global === 0 && i !== 0) { num++; } $(e).appendTo($target.find(".swiper-slide .row")[num]); }); } // 当窗口变化时, swiper怎么计算 // countLi的参数是swiper一屏的speaker的数量 function changeWindow(winw) { winw = $(window)[0].innerWidth; $('.speaker .swiper-slide').remove(); if (winw > 1200) { countLi(perview); item.css('width', 100 / (perview / 2) + '%'); } else if (winw <= 1200 && winw > 992) { countLi(6); } else if (winw <= 992 && winw > 750) { countLi(4); } else if (winw <= 750) { countLi(2); } } $(window).resize(function () { var w = $(window).width(); timer ? clearTimeout(timer) : ''; timer = setTimeout(function () { if (w != winw) { changeWindow(winw); winw = w; } }, 100); }) changeWindow(winw); // 初始化 swiper组件 new Swiper($target.find(".swiper"), { watchOverflow: true, slidesPerView: 1, spaceBetween: 20, // 板块与板块之间的间距 // 如果需要分页器 pagination: { el: $target.find('.swiper-pagination'), clickable: true, }, //大于分辨率 breakpoints: { 1200: { spaceBetween: 40, }, 750: { spaceBetween: 20, } }, }); } }) } // animate var winW, winH, scrollTop, translateY1Obj = ''; var numLine = [], boxTopAll = [], off = true; $(window).on("scroll.scrollBottomTopAnimeta", function () { if (off) { off = false animateInit(); } scrollBottomTopAnimeta(); }); // 页面滚动动画:初始化 var animateInitsetTimeout = ''; function animateInit() { translateY1Obj = $('.translateY1'); if (winW > 1100) { // 计算所有动画的位置 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)"); } } // 页面滚动动画:下到上 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 init1() { winW = $(window).width(); winH = $(window).height(); }; // 初始化 init1(); // 屏幕放大缩小,重新计算 var timer; $(window).on("resize", function () { clearTimeout(timer); timer = setTimeout(function () { var curwinW = $(window).width(); if (curwinW != winW) { init(); winW = curwinW; } }, 100) }) })