优化 layer 滑动切换细节
This commit is contained in:
parent
a4c78cc886
commit
ed2755bcce
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user