define("/Assets/enp/2022/js/module/e-module-202209161412.js", function (require, factory) { if ($('.e-module-202209161412').length > 0) { function module202209161412Fun($target) { var module202209161412Obj = { init: function () { // 获取属性 this.win = $(window); this.moduleObj = $target; this.resizeInit(); this.lazyPicLink(); this.initSwiper(); this.scrollEvent(); this.resizeEvent(); }, resizeInit: function () { this.winw = this.win.width(); this.winh = this.win.height(); // 获取位置 this.scrollTop = this.win.scrollTop(); this.moduleTop = this.moduleObj.offset().top; }, lazyPicLink: function () { // 加载图片 if (this.scrollTop + this.winh * 1.5 > this.moduleTop) { // 当滚动条滚动到当前位置时,加载视频 this.moduleImgObj = this.moduleObj.find("img"); this.moduleImgObj.each(function () { var $this = $(this); var src = $this.attr("data-original"); if ($this.attr("src") != src) { $this.attr("src", src) } }) } }, initSwiper: function () { var _this = this; var slideLength = _this.moduleObj.find(".swiper-slide").length; var mySwiper = new Swiper(_this.moduleObj.find(".swiper"), { watchOverflow: true, // 一屏不显示左右箭头以及pagination spaceBetween: 20, // 板块与板块之间的间距 slidesPerView: 1, //每屏幕显示的个数 slidesPerGroup: 1, // 每次轮播的个数 loop: slideLength > 1 ? true : false, // 设置自动轮播 noSwiping: slideLength > 1 ? false : true, autoplay: _this.moduleObj.data("auto-time") ? { delay: _this.moduleObj.data("auto-time"), stopOnLastSlide: false, disableOnInteraction: true } : false, pagination: { el: _this.moduleObj.find('.swiper-pagination'), clickable: true, }, on: { resize: function () { var This = this; setTimeout(function () { 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.202209161412', 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.202209161412', function () { var winw = _this.win.width(); if (winw != resizeWinw) { currentWinw = winw; // 删除之前的定时器 if (resizeTimer) { clearTimeout(resizeTimer); } // 添加新的定时器 resizeTimer = setTimeout(function () { _this.resizeInit(); _this.lazyPicLink(); }, 100) } }) } }; module202209161412Obj.init(); } // 初始化 $('.e-module-202209161412').each(function () { // 防止js文件被执行2次。 var _this = $(this); if (_this.data('init')) { return; } _this.data('init', true); module202209161412Fun($(this)); }) } });