From 65eb7c31ad5d0890c12fb2aea24916a4669b0db1 Mon Sep 17 00:00:00 2001 From: Kimmo Puputti Date: Wed, 17 Oct 2012 17:30:58 +0300 Subject: [PATCH] Apply the patch https://github.com/simonratner/SwipeView/commit/f1e1904746e31111d19af98c20ca623a62d12a25 by @simonratner to the latest repo. --- src/swipeview.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/swipeview.js b/src/swipeview.js index 56b0a00..41cbfe2 100644 --- a/src/swipeview.js +++ b/src/swipeview.js @@ -363,7 +363,7 @@ var SwipeView = (function (window, document) { if (!this.initiated) return; var point = hasTouch ? e.changedTouches[0] : e, - dist = Math.abs(point.pageX - this.startX); + dist = point.pageX - this.startX; this.initiated = false; @@ -375,8 +375,14 @@ var SwipeView = (function (window, document) { } // Check if we exceeded the snap threshold - if (dist < this.snapThreshold) { - this.slider.style[transitionDuration] = Math.floor(300 * dist / this.snapThreshold) + 'ms'; + if (Math.abs(dist) < this.snapThreshold) { + this.slider.style.webkitTransitionDuration = Math.floor(300 * Math.abs(dist) / this.snapThreshold) + 'ms'; + this.__pos(-this.page * this.pageWidth); + return; + } + // Check if swipe was cancelled by reversing swipe direction + if ((dist < 0 && this.directionX >= 0) || (dist > 0 && this.directionX <= 0)) { + this.slider.style.webkitTransitionDuration = Math.floor(300 * Math.abs(dist) / this.pageWidth) + 'ms'; this.__pos(-this.page * this.pageWidth); return; }