From d5c9ecedf2c3cb7366c544c22adbcee6c92ae348 Mon Sep 17 00:00:00 2001 From: cweijan Date: Mon, 4 Mar 2024 15:17:38 +0800 Subject: [PATCH] Remove image slide animation. --- resource/lightgallery/js/lightgallery.js | 30 ++++++++++++------------ resource/lightgallery/lg.html | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/resource/lightgallery/js/lightgallery.js b/resource/lightgallery/js/lightgallery.js index de28392..847a523 100644 --- a/resource/lightgallery/js/lightgallery.js +++ b/resource/lightgallery/js/lightgallery.js @@ -792,7 +792,7 @@ */ Plugin.prototype.slide = function(index, fromTouch, fromThumb, direction) { - var _prevIndex = this.$outer.find('.lg-current').index(); + var _prevIndex = this.$outer.find('.lg-current').index(); var _this = this; // Prevent if multiple call @@ -1236,29 +1236,29 @@ this.$slide.eq(_touchNext).addClass('lg-next-slide'); }; + let slideTime; Plugin.prototype.mousewheel = function() { var _this = this; - _this.$outer.on('mousewheel.lg', function(e) { + _this.$outer.on('mousewheel.lg', function(e) {}); + window.addEventListener('wheel',(e)=>{ if (!e.deltaY) { return; } + if(isCompose(e)){ + if (e.deltaY > 0) _this.callScale(_this.s.scale) + else _this.callScale(-_this.s.scale) + return; + } + const curTime=new Date().getTime(); + if(curTime-slideTime<800) return; + slideTime=curTime; if (e.deltaY > 0) { - if(isCompose(e)){ - _this.callScale(_this.s.scale) - }else{ - _this.goToPrevSlide(); - } + _this.goToPrevSlide(); } else { - if(isCompose(e)){ - _this.callScale(-_this.s.scale) - }else{ - _this.goToNextSlide(); - } + _this.goToNextSlide(); } - - e.preventDefault(); - }); + }) }; diff --git a/resource/lightgallery/lg.html b/resource/lightgallery/lg.html index 5438227..d333f7b 100644 --- a/resource/lightgallery/lg.html +++ b/resource/lightgallery/lg.html @@ -31,7 +31,7 @@ lg.lightGallery({ download: false, closable: false, - speed: 450, + speed: 0, controls: false, escKey: false, supportLegacyBrowser: false,