From ed2755bcceb6a422747de86115052c3a4f6a415f Mon Sep 17 00:00:00 2001 From: sight <1453017105@qq.com> Date: Tue, 12 Dec 2023 21:53:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20layer=20=E6=BB=91=E5=8A=A8?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/layer.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modules/layer.js b/src/modules/layer.js index a8a7e7a5..3f16df5f 100644 --- a/src/modules/layer.js +++ b/src/modules/layer.js @@ -1608,8 +1608,10 @@ layer.photos = function(options, loop, key){ if(window.layui || window.lay){ var lay = window.layui.lay || window.lay; var touchEndCallback = function(e, state){ - var threshold = 40; - var shouldSwipe = Math.abs(state.deltaX) > threshold; + var duration = Date.now() - state.timeStart; + var speed = state.deltaX / duration; + var threshold = win.width() / 3; + var shouldSwipe = Math.abs(speed) > 0.25 || Math.abs(state.deltaX) > threshold; if(!shouldSwipe) return; if(state.direction === 'left'){ dict.imgnext(true);