mirror of https://github.com/layui/layui
优化 layer 滑动切换细节
parent
a4c78cc886
commit
ed2755bcce
|
@ -1608,8 +1608,10 @@ layer.photos = function(options, loop, key){
|
||||||
if(window.layui || window.lay){
|
if(window.layui || window.lay){
|
||||||
var lay = window.layui.lay || window.lay;
|
var lay = window.layui.lay || window.lay;
|
||||||
var touchEndCallback = function(e, state){
|
var touchEndCallback = function(e, state){
|
||||||
var threshold = 40;
|
var duration = Date.now() - state.timeStart;
|
||||||
var shouldSwipe = Math.abs(state.deltaX) > threshold;
|
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(!shouldSwipe) return;
|
||||||
if(state.direction === 'left'){
|
if(state.direction === 'left'){
|
||||||
dict.imgnext(true);
|
dict.imgnext(true);
|
||||||
|
|
Loading…
Reference in New Issue