diff --git a/src/touch.js b/src/touch.js index a25fb6021..146620064 100644 --- a/src/touch.js +++ b/src/touch.js @@ -14,8 +14,10 @@ return xDelta >= yDelta ? (x1 - x2 > 0 ? 'Left' : 'Right') : (y1 - y2 > 0 ? 'Up' : 'Down') } - var longTapDelay = 750 + var longTapDelay = 750, longTapTimeout + function longTap(){ + longTapTimeout = null if (touch.last && (Date.now() - touch.last >= longTapDelay)) { touch.el.trigger('longTap') touch = {} @@ -31,8 +33,10 @@ touch.y1 = e.touches[0].pageY if (delta > 0 && delta <= 250) touch.isDoubleTap = true touch.last = now - setTimeout(longTap, longTapDelay) + longTapTimeout = setTimeout(longTap, longTapDelay) }).bind('touchmove', function(e){ + if (longTapTimeout) clearTimeout(longTapTimeout) + longTapTimeout = null touch.x2 = e.touches[0].pageX touch.y2 = e.touches[0].pageY }).bind('touchend', function(e){