Skip to content

Commit

Permalink
Added an optional parameter to stopAutoplay that (when not true, the …
Browse files Browse the repository at this point in the history
…default), will unbind internally set any internally set autoplay events. Fixes fredleblanc#1
  • Loading branch information
fredleblanc committed Dec 20, 2011
1 parent e5781df commit 5c4ddb4
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions jquery.roundabout.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* jQuery Roundabout - v2.1
* jQuery Roundabout - v2.1.1
* http://fredhq.com/projects/roundabout
*
* Moves list-items of enabled ordered and unordered lists long
Expand Down Expand Up @@ -230,10 +230,10 @@
// autoplay pause on hover
if (settings.autoplayPauseOnHover) {
self
.bind("mouseenter.roundabout", function() {
methods.stopAutoplay.apply(self);
.bind("mouseenter.roundabout.autoplay", function() {
methods.stopAutoplay.apply(self, [true]);
})
.bind("mouseleave.roundabout", function() {
.bind("mouseleave.roundabout.autoplay", function() {
methods.startAutoplay.apply(self);
});
}
Expand Down Expand Up @@ -935,19 +935,26 @@
methods.animateToNextChild.apply(self, [callback]);
}, data.autoplayDuration);
data.autoplayIsRunning = true;

self.trigger("autoplayStart");
});
},


// stopAutoplay
// stops autoplaying this roundabout
stopAutoplay: function() {
stopAutoplay: function(keepAutoplayBindings) {
return this
.each(function() {
clearInterval($(this).data("roundabout").autoplayInterval);
$(this).data("roundabout").autoplayInterval = null;
$(this).data("roundabout").autoplayIsRunning = false;

// this will prevent autoplayPauseOnHover from restarting autoplay
if (!keepAutoplayBindings) {
$(this).unbind(".autoplay")
}

$(this).trigger("autoplayStop");
});
},
Expand Down

0 comments on commit 5c4ddb4

Please sign in to comment.