diff options
Diffstat (limited to 'js/carousel.js')
| -rw-r--r-- | js/carousel.js | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/js/carousel.js b/js/carousel.js index be3ecf3de..fbd055116 100644 --- a/js/carousel.js +++ b/js/carousel.js @@ -100,13 +100,15 @@ $next = this.$element.find('.item')[fallback]() } - this.sliding = true - - isCycling && this.pause() + if ($next.hasClass('active')) return var e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction: direction }) + this.$element.trigger(e) + if (e.isDefaultPrevented()) return - if ($next.hasClass('active')) return + this.sliding = true + + isCycling && this.pause() if (this.$indicators.length) { this.$indicators.find('.active').removeClass('active') @@ -117,8 +119,6 @@ } if ($.support.transition && this.$element.hasClass('slide')) { - this.$element.trigger(e) - if (e.isDefaultPrevented()) return $next.addClass(type) $next[0].offsetWidth // force reflow $active.addClass(direction) @@ -132,8 +132,6 @@ }) .emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000) } else { - this.$element.trigger(e) - if (e.isDefaultPrevented()) return $active.removeClass('active') $next.addClass('active') this.sliding = false |
