diff options
| author | Roland Warmerdam <[email protected]> | 2013-08-31 18:03:09 +1200 |
|---|---|---|
| committer | Roland Warmerdam <[email protected]> | 2013-08-31 18:03:09 +1200 |
| commit | ed1bd2b150dd645c11f92126a12183985ddbbc15 (patch) | |
| tree | e22627ae07b02be2d5fed2c5bd9a65dac3ce1439 /js/carousel.js | |
| parent | 5b21768c054b86dd9f27eea9879f75668546cdc4 (diff) | |
| download | bootstrap-ed1bd2b150dd645c11f92126a12183985ddbbc15.tar.xz bootstrap-ed1bd2b150dd645c11f92126a12183985ddbbc15.zip | |
carousel: correctly reset when the slide event is prevented
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 d8c4c243c..08d53b893 100644 --- a/js/carousel.js +++ b/js/carousel.js @@ -111,13 +111,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') @@ -128,8 +130,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) @@ -143,8 +143,6 @@ }) .emulateTransitionEnd(600) } else { - this.$element.trigger(e) - if (e.isDefaultPrevented()) return $active.removeClass('active') $next.addClass('active') this.sliding = false |
