$(function () { // 新闻 if ($(".e-module-202406041415").length > 0 && $(window).width() > 750) { $(".e-module-202406041415 .right .e-scroll-vrt-d1-2").height($(".e-module-202406041415 .left a") .height() + 0) } }) $(function () { //金句 if ($('.e-module-202306011432').length > 0) { function module202306011432Fun($target) { var module202306011432Obj = { init: function () { // 获取属性 this.win = $(window); this.moduleObj = $target; this.moduleWrapperObj = this.moduleObj.find(".swiper-wrapper"); this.moduleSlideObj = this.moduleObj.find(".swiper-slide"); this.resizeInit(); // resize初始化 this.judgmentSwiper(); // 判断需不需要执行swiper this.scrollEvent(); // 设置滚动事件,文字动画效果 this.resizeEvent(); // 设置自适应 this.lazyPicLink(); // 是否加载图片 }, resizeInit: function () { this.winw = this.win.width(); this.winh = this.win.height(); // 获取位置 this.scrollTop = this.win.scrollTop(); this.moduleTop = this.moduleObj.offset().top; }, judgmentSwiper: function () { if (this.moduleSlideObj.length > 1) { if (this.moduleObj.data("swiper-init")) { return; } this.moduleObj.data("swiper-init", true); this.initSwiper(); } }, lazyPicLink: function () { // 加载图片 if (this.scrollTop + this.winh * 1.5 > this.moduleTop) { // 当滚动条滚动到当前位置时,加载视频 // this.moduleSlideObj = this.moduleObj.find(".swiper-slide"); // this.moduleSlideObj.each(function () { // var $this = $(this); // var imgObj = $this.find('img'); // var src = imgObj.attr("data-original"); // if (imgObj.attr("src") != src) { // imgObj.attr("src", src) // } // }) var moduleImgObj = this.moduleObj.find("img"); moduleImgObj.each(function () { var $this = $(this); var src = $this.attr("data-original"); if ($this.attr("src") != src) { $this.attr("src", src); $this.parent().addClass("over").css({ "height": "auto", "background": "none" }) } }) } }, initSwiper: function () { var _this = this; var slideLength = $target.find(".swiper-slide").length; if (slideLength > 3) { var mySwiper = new Swiper($target.find(".swiper"), { watchOverflow: true, // 一屏不显示左右箭头以及pagination spaceBetween: 20, // 板块与板块之间的间距 slidesPerView: 1.1, //没屏幕显示的个数 resistanceRatiao: 1, //触底不反弹 autoplay: false, centeredSlides: true, loop: true, // 设置自动轮播 // 如果需要前进后退按钮 navigation: { nextEl: $target.find('.swiper-button-next'), prevEl: $target.find('.swiper-button-prev'), }, pagination: { // 设置点点点 el: $target.find('.swiper-pagination'), type: "fraction", }, breakpoints: { 1200: { slidesPerView: 3.2, autoplay: false, spaceBetween: -10, autoplay: false, }, 992: { slidesPerView: 2.2, autoplay: false, spaceBetween: -20, resistanceRatiao: 1, //触底不反弹 autoplay: false, }, 768: { slidesPerView: 1, autoplay: false, spaceBetween: 0, resistanceRatiao: 1, //触底不反弹 autoplay: false, }, }, on: { init: function () { if (_this.winw < 992) { setTimeout(function () { $target.find(".li").height( $target.find('.z_cc') .height()); }, 500) } }, resize: function () { var This = this; setTimeout(function () { This.emit('init'); This .update(); //窗口变化时,更新Swiper的一些属性,如宽高等 }, 150) }, } }); } else { var mySwiper = new Swiper($target.find(".swiper"), { watchOverflow: true, // 一屏不显示左右箭头以及pagination spaceBetween: 20, // 板块与板块之间的间距 slidesPerView: 1.1, //没屏幕显示的个数 resistanceRatiao: 1, //触底不反弹 autoplay: false, centeredSlides: true, loop: true, // 设置自动轮播 // 如果需要前进后退按钮 navigation: { nextEl: $target.find('.swiper-button-next'), prevEl: $target.find('.swiper-button-prev'), }, pagination: { // 设置点点点 el: $target.find('.swiper-pagination'), type: "fraction", }, breakpoints: { 1200: { slidesPerView: 2.8, autoplay: false, spaceBetween: -10, autoplay: false, }, 992: { slidesPerView: 2.2, autoplay: false, spaceBetween: -20, resistanceRatiao: 1, //触底不反弹 autoplay: false, }, 768: { slidesPerView: 1, autoplay: false, spaceBetween: 0, resistanceRatiao: 1, //触底不反弹 autoplay: false, }, }, on: { init: function () { if (_this.winw < 992) { setTimeout(function () { $target.find(".li").height( $target.find('.z_cc') .height()); }, 500) } }, resize: function () { var This = this; setTimeout(function () { This.emit('init'); This .update(); //窗口变化时,更新Swiper的一些属性,如宽高等 }, 150) }, } }); } }, scrollEvent: function () { var _this = this; _this.win.on('scroll.202306011432', function () { // 获取位置 _this.scrollTop = _this.win.scrollTop(); _this.moduleTop = _this.moduleObj.offset().top; _this.lazyPicLink(); // 视频是否图片 }); }, resizeEvent: function () { // 页面resize事件 var _this = this; var resizeWinw = 0; var resizeTimer = ''; this.win.on('resize.202306011432', function () { var winw = _this.win.width(); if (winw != resizeWinw) { currentWinw = winw; // 删除之前的定时器 if (resizeTimer) { clearTimeout(resizeTimer); } // 添加新的定时器 resizeTimer = setTimeout(function () { _this.resizeInit(); // resize初始化 _this.judgmentSwiper(); // 判断需不需要执行swiper _this.scrollEvent(); // 设置滚动事件,文字动画效果 }, 100) } }) } }; module202306011432Obj.init(); } // 初始化 $('.e-module-202306011432').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202306011432Fun($(this)); }) } }) $(function () { // 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(".points-text-button"); // 数组存储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).parents('.swiper-con').addClass('filp') }) _this.reverseBtn.on('click', function () { $(this).parents('.swiper-con').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, 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) } }, }); }, 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)); }) } })