There's unfortunately no convenient way to determine the delta of a touch 'pan'. What you'll need to do is store the initial touch location on ontouchstart
, and then on ontouchmove
compare the current touch location to the starting location (specifically the y component in this instance) to calculate the delta and determine if the user dragged up or down.
$("#myElement").on("touchstart", function(e) {
var startingY = e.originalEvent.touches[0].pageY;
$("#myElement").on("touchmove", function(e) {
currentY = e.originalEvent.touches[0].pageY;
var delta = currentY - startingY;
});
});
In the above example delta
would be the distance panned, updated every time touchmove
is fired. Also, don't forget to unbind touchmove
on touchend
.