$(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 = '