Skip to content

Commit

Permalink
Fixed animation queue bugs.
Browse files Browse the repository at this point in the history
  • Loading branch information
akalicki committed Jul 14, 2013
1 parent bf25fe4 commit f26c38f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
16 changes: 10 additions & 6 deletions simple-gallery.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* simple-gallery.js - v1.1.0
* simple-gallery.js - v1.2.0
* Author: Alex Kalicki (https://github.com/akalicki)
*
* simple-gallery.js is a lightweight jQuery extension for quickly creating
Expand All @@ -17,6 +17,7 @@
// global plugin variables
var obj = this;
var nextImg = options.startImg;
var cycle;

// set the target background CSS, perform any needed initialization
$.fn.gallery.init = function() {
Expand Down Expand Up @@ -57,13 +58,16 @@

// transition out, select new image, transition in
function changeToImg(index) {
$(options.target).clearQueue();
$.fn.gallery.startTransition();
$(options.target).promise().done(function() {
$(options.target).queue(function() {
selectImg(index);
$.fn.gallery.endTransition();
$(options.target).promise().done(function() {
cycle = window.setTimeout(loadNext, options.waitTime);
});
$(this).dequeue();
});
$.fn.gallery.endTransition();
$(options.target).queue(function() {
cycle = window.setTimeout(loadNext, options.waitTime);
$(this).dequeue();
});
}

Expand Down
4 changes: 2 additions & 2 deletions simple-gallery.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f26c38f

Please sign in to comment.