Skip to content

Commit

Permalink
fixes autoplay bug mentioned in comments in nolimits4web#191 fixes no…
Browse files Browse the repository at this point in the history
  • Loading branch information
mehernosh committed Jul 11, 2013
1 parent c4c60ec commit 4c09cbd
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions dev/idangerous.swiper.js
Original file line number Diff line number Diff line change
Expand Up @@ -1905,24 +1905,24 @@ var Swiper = function (selector, params) {
/*==========================================
Autoplay
============================================*/
var autoPlayInterval = undefined;
_this.startAutoplay = function() {
if (typeof autoPlayInterval !== 'undefined') return false;
_this.autoPlayIntervalId = undefined;
_this.startAutoplay = function () {
if (typeof _this.autoPlayIntervalId !== 'undefined') return false;
if (params.autoplay && !params.loop) {
autoPlayInterval = setInterval(function(){
_this.autoPlayIntervalId = setInterval(function(){
if (!_this.swipeNext(true)) _this.swipeTo(0);
}, params.autoplay)
}
if (params.autoplay && params.loop) {
autoPlayInterval = setInterval(function(){
_this.autoPlayIntervalId = setInterval(function(){
_this.swipeNext();
}, params.autoplay)
}
_this.callPlugins('onAutoplayStart');
}
_this.stopAutoplay = function() {
if (autoPlayInterval) clearInterval(autoPlayInterval);
autoPlayInterval = undefined;
_this.stopAutoplay = function () {
if (_this.autoPlayIntervalId) clearInterval(_this.autoPlayIntervalId);
_this.autoPlayIntervalId = undefined;
_this.callPlugins('onAutoplayStop');
}
/*==================================================
Expand Down

0 comments on commit 4c09cbd

Please sign in to comment.