Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix slide animation bug. (when duration is set to zero.) #441

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions swipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}

Expand Down Expand Up @@ -567,4 +569,4 @@ if ( window.jQuery || window.Zepto ) {
});
}
})( window.jQuery || window.Zepto )
}
}