$(function () { var winW = $(window).width(); function setVideoBg() { if (winW > 1200) { $('.video-bg').each(function () { $(this).find('video').attr('src', $(this).data('url')); }) } else { $('.video-bg video').attr('src', ''); } $('.iframe-bg').each(function () { $(this).find('iframe').attr('src', $(this).data('url')); }) } setVideoBg() // 导航 $("#mob-menubtn").on("click", function () { $('.main-header').addClass('open'); $('#close-menubtn').show(); $('#mob-menubtn').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() { // $('.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'); // 锚点定位,如果链接有带参数,自动触发点击事件 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'); // $('.logo img').attr('src', 'https://e.huawei.com/topic/sitecore/2023-mwc/img/banner/logo_huawei.png'); } else { navObj.removeClass('fix'); // $('.logo img').attr('src', 'https://e.huawei.com/topic/sitecore/2023-mwc/img/banner/logo_huawei2.png'); } // 获取每个版块的到页面顶部的位置 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(); // banner if ($('.e-module-202208161027').length > 0) { function module202208161027Fun($target) { var module202208161027Obj = { init: function () { // 获取属性 this.win = $(window); this.moduleObj = $target; this.h400TextObj = this.moduleObj.hasClass('h400Text'); this.moduleSlideObj = this.moduleObj.find(".swiper-slide"); this.resizeInit(); // resize初始化 this.saveAClass(); // 如果移动端设置了文字在图片下面,保存按钮颜色 this.setWapBtnColor(); // 如果移动端设置了文字在图片下面,设置按钮颜色为黑色 this.judgmentSwiper(); // 判断需不需要执行swiper,如果只有一个就不需要执行。多个就需要执行 this.scrollEvent(); // 设置滚动事件,文字动画效果 this.resizeEvent(); // 设置自适应 this.lazyVideoLink(); // 视频是否加载 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; }, saveAClass: function () { var _this = this; if (_this.h400TextObj) { _this.aClassArr = []; $target.find('a').each(function () { _this.aClassArr.push($(this).attr('class')); }) } }, setWapBtnColor: function () { var _this = this; // 不管pc端按钮是什么颜色,到了移动端都是黑色按钮 if (_this.h400TextObj) { if (_this.winw < 920) { $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]); }) } } }, 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.addPicLink(); } }, lazyVideoLink: function () { // 加载视频 if (this.scrollTop + this.winh * 1.5 > this.moduleTop) { // 当滚动条滚动到当前位置时,加载视频 this.addVideoLink(); } }, addPicLink: function () { this.moduleSlideObj = this.moduleObj.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"), { 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 () { // 根据文字颜色变化底部点点点的颜色 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.202208161027', function () { // 获取位置 _this.scrollTop = _this.win.scrollTop(); _this.moduleTop = _this.moduleObj.offset().top; _this.lazyVideoLink(); // 视频是否加载 _this.lazyPicLink(); // 视频是否图片 }); }, resizeEvent: function () { // 页面resize事件 var _this = this; var resizeWinw = 0; var resizeTimer = ''; this.win.on('resize.202208161027', function () { var winw = _this.win.width(); if (winw != resizeWinw) { currentWinw = winw; // 删除之前的定时器 if (resizeTimer) { clearTimeout(resizeTimer); } // 添加新的定时器 resizeTimer = setTimeout(function () { _this.resizeInit(); // resize初始化 _this.setWapBtnColor(); // 设置按钮颜色 _this.scrollEvent(); // 设置滚动事件,文字动画效果 }, 200) } }) } }; module202208161027Obj.init(); } // 初始化 $('.e-module-202208161027').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202208161027Fun($(this)); }) } // countries if ($('.e-module-202404151643').length > 0) { function module202404151643Fun($target) { var module202404151643Obj = { 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) { console.log(111) 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); if (this.winw > 992) { 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 slideLength = $target.find(".swiper-slide").length; var mySwiper = new Swiper($target.find(".swiper"), { watchOverflow: true, // 一屏不显示左右箭头以及pagination spaceBetween: 20, // 板块与板块之间的间距 slidesPerView: 'auto', //每屏幕显示的个数 resistanceRatiao: 1, //触底不反弹 direction: getDirection(), // 如果需要前进后退按钮 navigation: { nextEl: $target.find('.swiper-button-next'), prevEl: $target.find('.swiper-button-prev'), }, // pagination: { // 设置点点点 // el: $target.find('.swiper-pagination'), // clickable: true, // }, breakpoints: { 1200: { spaceBetween: 40, }, 992: { spaceBetween: 20, }, }, on: { init: function () { }, resize: function () { var This = this; setTimeout(function () { This.emit('init'); This.update(); //窗口变化时,更新Swiper的一些属性,如宽高等 }, 150) }, } }); function getDirection() { var direction = _this.winw < 992 ? 'vertical' : 'horizontal'; return direction; } }, scrollEvent: function () { var _this = this; _this.win.on('scroll.202404151643', 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.202404151643', 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) } }) } }; module202404151643Obj.init(); } // 初始化 $('.e-module-202404151643').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202404151643Fun($(this)); }) } // business if ($('.e-module-202404151519').length > 0) { function module202404151519Fun($target) { var module202404151519Obj = { 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: 1, //没屏幕显示的个数 resistanceRatiao: 1, //触底不反弹 slidesPerGroup: 1, // 每次轮播的个数 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, // 如果需要前进后退按钮 navigation: { nextEl: $target.find('.swiper-button-next'), prevEl: $target.find('.swiper-button-prev'), }, pagination: { // 设置点点点 el: $target.find('.swiper-pagination'), clickable: true, }, breakpoints: { 1200: { slidesPerView: 3, spaceBetween: 40, loop: slideLength > 3 ? true : false, // 设置自动轮播 }, 992: { slidesPerView: 3, spaceBetween: 20, loop: slideLength > 3 ? true : false, // 设置自动轮播 }, 750: { slidesPerView: 2, spaceBetween: 20, loop: slideLength > 2 ? 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.202404151519', 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.202404151519', 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) } }) } }; module202404151519Obj.init(); } // 初始化 $('.e-module-202404151519').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202404151519Fun($(this)); }) } // agenda if ($('.e-module-202404171724').length > 0) { function module202404171724Fun($target) { var module202404171724Obj = { init: function () { // 获取属性 this.win = $(window); this.moduleObj = $target; this.tabUl = this.moduleObj.find('.tablist'); this.tabLi = this.moduleObj.find('.tablist .tab'); this.tabCon = this.moduleObj.find('.agenda-bot-con'); // 数组存储swiper对象 this.swiper = {}; this.resizeInit(); // resize初始化 this.scrollEvent(); // 设置滚动事件,文字动画效果 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) { // 当滚动条滚动到当前位置时,加载视频 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(); }); _this.tabLi.eq(0).trigger('click'); }, scrollEvent: function () { var _this = this; _this.win.on('scroll.202404171724', 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.202404171724', function () { var winw = _this.win.width(); if (winw != resizeWinw) { currentWinw = winw; // 删除之前的定时器 if (resizeTimer) { clearTimeout(resizeTimer); } // 添加新的定时器 resizeTimer = setTimeout(function () { _this.resizeInit(); // resize初始化 _this.scrollEvent(); // 设置滚动事件,文字动画效果 }, 100) } }) } }; module202404171724Obj.init(); } // 初始化 $('.e-module-202404171724').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202404171724Fun($(this)); }) } // highlights if ($('.e-module-202404181732').length > 0) { function module202404181732Fun($target) { var module202404181732Obj = { 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 $(window).on("load", function () { var _this = this; var viewBox = $('body').find('.view-pop'); var closeFull = $('body').find('.view-box .close-full'); $(".highlights-item .swiper-slide").on('click', function () { var oImg = $(this).find('img').attr('data-xl'); viewBox.find('img').attr('src', oImg); viewBox.fadeIn(400); $('body').css('overflow', 'hidden') }) // 点击关闭按钮关闭弹框 closeFull.on('click', function () { viewBox.fadeOut(400); $('body').css('overflow', 'auto') }) $('body').on('click', ".view-pop", function () { viewBox.fadeOut(400); $('body').css('overflow', 'auto') }) $('body').on('click', '.largeshow', function (e) { e.stopPropagation(); }) }) 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) } }) } }, clickEvent: function () { var _this = this; var viewBox = $('body').find('.view-box'); var closeFull = $('body').find('.view-box .close-full'); _this.moduleSlideObj.find('.e-lazy').on('click', function () { console.log(111) // var oImg = $(this).find('img').attr('data-xl'); // viewBox.find('img').attr('src', oImg); // viewBox.fadeIn(400); // $('body').css('overflow', 'hidden') }) // 点击关闭按钮关闭弹框 closeFull.on('click', function () { // console.log(222) // viewBox.fadeOut(400) // $('body').css('overflow', 'auto') }) }, initSwiper: function () { var _this = this; var slideLength = $target.find(".swiper-slide").length; var mySwiper1 = new Swiper($target.find(".swiper1"), { watchOverflow: true, // 一屏不显示左右箭头以及pagination spaceBetween: 15, // 板块与板块之间的间距 slidesPerView: 2, //没屏幕显示的个数 resistanceRatiao: 1, //触底不反弹 freeMode: true, observe: true, observeParents: true, speed: 6000, autoplay: { delay: 0, stopOnLastSlide: false, // disableOnInteraction: true, }, loop: true, // 设置自动轮播 breakpoints: { 1200: { slidesPerView: 4, spaceBetween: 40, }, 992: { slidesPerView: 3, spaceBetween: 15, }, }, on: { init: function () { }, resize: function () { var This = this; setTimeout(function () { This.emit('init'); This.update(); //窗口变化时,更新Swiper的一些属性,如宽高等 }, 150) }, } }); var mySwiper2 = new Swiper($target.find(".swiper2"), { watchOverflow: true, // 一屏不显示左右箭头以及pagination spaceBetween: 15, // 板块与板块之间的间距 slidesPerView: 2, //没屏幕显示的个数 resistanceRatiao: 1, //触底不反弹 freeMode: true, observe: true, observeParents: true, speed: 7000, autoplay: { delay: 0, stopOnLastSlide: false, disableOnInteraction: true, }, loop: true, // 设置自动轮播 breakpoints: { 1200: { slidesPerView: 4, spaceBetween: 40, }, 992: { slidesPerView: 3, spaceBetween: 15, }, }, on: { init: function () { }, resize: function () { var This = this; setTimeout(function () { This.emit('init'); This.update(); //窗口变化时,更新Swiper的一些属性,如宽高等 }, 150) }, } }); }, scrollEvent: function () { var _this = this; _this.win.on('scroll.202404181732', 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.202404181732', 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) } }) } }; module202404181732Obj.init(); } // 初始化 $('.e-module-202404181732').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202404181732Fun($(this)); }) } // 侧边栏 if ($('.e-module-202208160923').length > 0) { function module202208160923Fun($target) { var module202208160923Obj = { init: function () { // 获取属性 this.win = $(window); this.moduleObj = $target; this.slideItem3Obj = this.moduleObj.find(".slide-item3"); this.slideItem2Obj = this.moduleObj.find(".slide-item2"); this.closeBtnObj = this.moduleObj.find(".close-btn"); this.tellConMobObj = this.moduleObj.find(".tell-con-mob"); this.resizeInit(); this.clickEvent(); this.scrollEvent(); }, resizeInit: function () { this.winw = this.win.width(); // 获取位置 this.scrollTop = this.win.scrollTop(); }, clickEvent: function () { var _this = this; // 点击top按钮,页面回到顶部 _this.slideItem3Obj.on('click', function () { $("html, body").animate({ scrollTop: 0 }); }) // 移动端点击电话icon,弹框显示 _this.slideItem2Obj.on('click', function () { if (_this.winw < 1200) { _this.tellConMobObj.show(); } }) // 点击弹框的xx按钮,关闭弹框 _this.closeBtnObj.on('click', function () { if (_this.winw < 1200) { _this.tellConMobObj.hide(); } }) }, scrollEvent: function () { var _this = this; _this.win.on('scroll.202208160923', function () { // 获取位置 _this.scrollTop = _this.win.scrollTop(); // 三元表达式进行高度判断 if (_this.winw > 1200) { _this.scrollTop >= 700 ? _this.slideItem3Obj.fadeIn() : _this.slideItem3Obj.fadeOut(); } }); } }; module202208160923Obj.init(); } // 初始化 $('.e-module-202208160923').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202208160923Fun($(this)); }) } })