...
|
...
|
@@ -30,6 +30,7 @@ function DragableElm(elm) { |
|
|
let _endY = 0;
|
|
|
let _open = false;
|
|
|
let _startTime = 0;
|
|
|
let _canDrag = true;
|
|
|
|
|
|
const moveElm = (y) => {
|
|
|
_moveY = Math.min(Math.max(y, _maxY), 0);
|
...
|
...
|
@@ -52,16 +53,32 @@ function DragableElm(elm) { |
|
|
});
|
|
|
};
|
|
|
|
|
|
elm.find('.detail-container').scroll(e => {
|
|
|
_canDrag = !!(_open && e.target.scrollTop < 10);
|
|
|
});
|
|
|
|
|
|
elm.on('touchstart', e => {
|
|
|
if (!_canDrag && open) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
let point = get(e, 'originalEvent.targetTouches[0]') || {};
|
|
|
|
|
|
_startY = point.pageY;
|
|
|
_startTime = new Date();
|
|
|
}).on('touchmove', e => {
|
|
|
if (!_startTime) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
let point = get(e, 'originalEvent.targetTouches[0]') || {};
|
|
|
|
|
|
moveElm(point.pageY - _startY + _endY);
|
|
|
}).on('touchend', e => {
|
|
|
if (!_startTime) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
let time = new Date() - _startTime;
|
|
|
let movedY = Math.abs(_moveY - _endY);
|
|
|
let moveOption = {};
|
...
|
...
|
@@ -92,6 +109,7 @@ function DragableElm(elm) { |
|
|
_open = !_open;
|
|
|
}
|
|
|
}, moveOption.time);
|
|
|
_startTime = 0;
|
|
|
});
|
|
|
}
|
|
|
|
...
|
...
|
|