You can use e.originalEvent.gesture.deltaX to determine whether the end of is moving left or right compared to the beginning :
var deltaX = e.originalEvent.gesture.deltaX;
if (deltaX > 0) {
// 右移
} else if (deltaX < 0) {
// 左移
}
The
panleft and panright events are constantly triggered during the movement, and are judged to move left or right relative to the position last time was triggered. If you want to see whether is moved left or right when ends compared to when begins , then the above method is OK; If you want to see whether the panleft event or was triggered last panright event, then we can only monitor the panleft and panright events, but it seems impossible to monitor the panend
You can use
Thee.originalEvent.gesture.deltaX
to determine whether the endof
is moving left or right compared to the beginning:
panleft
event. 🎜and
panrightevents are
constantlytriggered during the movement, and are judged to move left or right relative to the position
last timewas triggered.
If you want to see whetheris moved left or right when
ends
compared towhen
begins, then the above method is OK;
If you want to see whether the
panleftevent or
was triggered last panrightevent, then we can only monitor the
panleftand
panrightevents, but it seems impossible to monitor the
panend