diff options
| author | Jacob Thornton <[email protected]> | 2012-03-24 18:20:09 -0700 |
|---|---|---|
| committer | Jacob Thornton <[email protected]> | 2012-03-24 18:20:09 -0700 |
| commit | bccc2cb7191eb54a4d67563625a748d7ecd381d4 (patch) | |
| tree | c4562643867c197b7f7f5792694e3e10aab8de52 /js/bootstrap-carousel.js | |
| parent | ef5ac02b698ffab3a42d21f20859b70df85543c0 (diff) | |
| download | bootstrap-bccc2cb7191eb54a4d67563625a748d7ecd381d4.tar.xz bootstrap-bccc2cb7191eb54a4d67563625a748d7ecd381d4.zip | |
add preventDefault support for all inital event types (show, close, hide, etc.) + fix small bug with scrollspy.last
Diffstat (limited to 'js/bootstrap-carousel.js')
| -rw-r--r-- | js/bootstrap-carousel.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/js/bootstrap-carousel.js b/js/bootstrap-carousel.js index 7db5bea33..8ce7418d2 100644 --- a/js/bootstrap-carousel.js +++ b/js/bootstrap-carousel.js @@ -86,6 +86,7 @@ , direction = type == 'next' ? 'left' : 'right' , fallback = type == 'next' ? 'first' : 'last' , that = this + , e = $.Event('slide') this.sliding = true @@ -96,11 +97,12 @@ if ($next.hasClass('active')) return 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) $next.addClass(direction) - this.$element.trigger('slide') this.$element.one($.support.transition.end, function () { $next.removeClass([type, direction].join(' ')).addClass('active') $active.removeClass(['active', direction].join(' ')) @@ -108,7 +110,8 @@ setTimeout(function () { that.$element.trigger('slid') }, 0) }) } else { - this.$element.trigger('slide') + this.$element.trigger(e) + if (e.isDefaultPrevented()) return $active.removeClass('active') $next.addClass('active') this.sliding = false |
