diff --git a/src/js/plugin/handler/touch.js b/src/js/plugin/handler/touch.js index ba5d133..c4368ab 100644 --- a/src/js/plugin/handler/touch.js +++ b/src/js/plugin/handler/touch.js @@ -88,32 +88,37 @@ function bindTouchHandler(element, i, supportsTouch, supportsIePointer) { } } function touchMove(e) { - if (!inLocalTouch && i.settings.swipePropagation) { - touchStart(e); - } - if (!inGlobalTouch && inLocalTouch && shouldHandle(e)) { - var touch = getTouch(e); + var target = e.target; + var className = target && target.getAttribute('class') || ''; - var currentOffset = {pageX: touch.pageX, pageY: touch.pageY}; - - var differenceX = currentOffset.pageX - startOffset.pageX; - var differenceY = currentOffset.pageY - startOffset.pageY; - - applyTouchMove(differenceX, differenceY); - startOffset = currentOffset; - - var currentTime = (new Date()).getTime(); - - var timeGap = currentTime - startTime; - if (timeGap > 0) { - speed.x = differenceX / timeGap; - speed.y = differenceY / timeGap; - startTime = currentTime; + if (!className.match(/ps-prevent-touchmove/)) { + if (!inLocalTouch && i.settings.swipePropagation) { + touchStart(e); } + if (!inGlobalTouch && inLocalTouch && shouldHandle(e)) { + var touch = getTouch(e); - if (shouldPreventDefault(differenceX, differenceY)) { - e.stopPropagation(); - e.preventDefault(); + var currentOffset = {pageX: touch.pageX, pageY: touch.pageY}; + + var differenceX = currentOffset.pageX - startOffset.pageX; + var differenceY = currentOffset.pageY - startOffset.pageY; + + applyTouchMove(differenceX, differenceY); + startOffset = currentOffset; + + var currentTime = (new Date()).getTime(); + + var timeGap = currentTime - startTime; + if (timeGap > 0) { + speed.x = differenceX / timeGap; + speed.y = differenceY / timeGap; + startTime = currentTime; + } + + if (shouldPreventDefault(differenceX, differenceY)) { + e.stopPropagation(); + e.preventDefault(); + } } } }