From 43b4a63cc820d62005a89ac2078bd9725903b523 Mon Sep 17 00:00:00 2001 From: Mathijs de Bruin Date: Wed, 12 Feb 2014 14:17:46 +0100 Subject: [PATCH] Fix for #29; instant snap back when looping: false --- src/swipeview.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/swipeview.js b/src/swipeview.js index 56b0a00..fbd4ad6 100644 --- a/src/swipeview.js +++ b/src/swipeview.js @@ -363,19 +363,19 @@ var SwipeView = (function (window, document) { if (!this.initiated) return; var point = hasTouch ? e.changedTouches[0] : e, - dist = Math.abs(point.pageX - this.startX); + dist = Math.abs(point.pageX - this.startX), + movein = !this.options.loop && (this.x > 0 || this.x < this.maxX); this.initiated = false; if (!this.moved) return; - if (!this.options.loop && (this.x > 0 || this.x < this.maxX)) { - dist = 0; + if (movein) { this.__event('movein'); } // Check if we exceeded the snap threshold - if (dist < this.snapThreshold) { + if (dist < this.snapThreshold || movein) { this.slider.style[transitionDuration] = Math.floor(300 * dist / this.snapThreshold) + 'ms'; this.__pos(-this.page * this.pageWidth); return;