From 94aa4a6db3ee752ef015e26b39fb97755cf961d0 Mon Sep 17 00:00:00 2001 From: yoonsy Date: Wed, 19 Mar 2014 20:32:37 +0900 Subject: [PATCH] fix slide animation bug. (when duration is set to zero.) --- swipe.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/swipe.js b/swipe.js index 8b29717..6addc0d 100644 --- a/swipe.js +++ b/swipe.js @@ -112,6 +112,8 @@ function Swipe(container, options) { // do nothing if already on requested slide if (index == to) return; + var moveSpeed = isNaN(slideSpeed) ? speed : slideSpeed; + if (browser.transitions) { var direction = Math.abs(index-to) / (index-to); // 1: backward, -1: forward @@ -134,15 +136,15 @@ function Swipe(container, options) { to = circle(to); - move(index, width * direction, slideSpeed || speed); - move(to, 0, slideSpeed || speed); + move(index, width * direction, moveSpeed); + move(to, 0, moveSpeed); if (options.continuous) move(circle(to - direction), -(width * direction), 0); // we need to get the next in place } else { to = circle(to); - animate(index * -width, to * -width, slideSpeed || speed); + animate(index * -width, to * -width, moveSpeed); //no fallback for a circular continuous if the browser does not accept transitions } @@ -567,4 +569,4 @@ if ( window.jQuery || window.Zepto ) { }); } })( window.jQuery || window.Zepto ) -} +} \ No newline at end of file