diff --git a/docs/javascript.html b/docs/javascript.html
index a63350c3d9..a46813ad8f 100644
--- a/docs/javascript.html
+++ b/docs/javascript.html
@@ -350,7 +350,7 @@ $('#myModal').on('hidden', function () {
@fat
@mdo
- Dropdown
+ Dropdown
-$('.myCarousel').carousel({
- interval: 2000
-})
-.carousel('cycle')
-Cycles through the carousel items from left to right.
-.carousel('pause')
-Stops the carousel from cycling through items.
-.carousel('prev')
-Cycles to the previous item.
-.carousel('next')
-Cycles to the next item.
+ Methods
+ .carousel(options)
+ Initializes the carousel with an optional options object
and starts cycling through items.
+
+ $('.myCarousel').carousel({
+ interval: 2000
+ })
+ .carousel('cycle')
+ Cycles through the carousel items from left to right.
+ .carousel('pause')
+ Stops the carousel from cycling through items.
+ .carousel('prev')
+ Cycles to the previous item.
+ .carousel('next')
+ Cycles to the next item.
+ Events
+ Bootstrap's modal class exposes a few events for hooking into modal functionality.
+
+
+
+ Event |
+ Description |
+
+
+
+
+ slide |
+ This event fires immediately when the slide instance method is invoked. |
+
+
+ slid |
+ This event is fired when the carousel has completed it's slide transition. |
+
+
+
+
Demo
diff --git a/js/bootstrap-carousel.js b/js/bootstrap-carousel.js
index fa5247c97e..c49f89ad80 100644
--- a/js/bootstrap-carousel.js
+++ b/js/bootstrap-carousel.js
@@ -44,10 +44,12 @@
}
, next: function () {
+ if (this.sliding) return
return this.slide('next')
}
, prev: function () {
+ if (this.sliding) return
return this.slide('prev')
}
@@ -59,21 +61,29 @@
, fallback = type == 'next' ? 'first' : 'last'
, that = this
+ this.sliding = true
+
isCycling && this.pause()
$next = $next.length ? $next : this.$element.find('.item')[fallback]()
if (!$.support.transition && this.$element.hasClass('slide')) {
+ this.$element.trigger('slide')
$active.removeClass('active')
$next.addClass('active')
+ this.$element.trigger('slid')
+ this.sliding = false
} else {
$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(' '))
+ that.$element.trigger('slid')
+ that.sliding = false
})
}
diff --git a/js/bootstrap-dropdown.js b/js/bootstrap-dropdown.js
index d846f1af1b..3cb2619929 100644
--- a/js/bootstrap-dropdown.js
+++ b/js/bootstrap-dropdown.js
@@ -38,12 +38,14 @@
var $this = $(this)
, selector = $this.attr('data-target') || $this.attr('href')
, $parent = $(selector)
+ , isActive
$parent.length || ($parent = $this.parent())
+ isActive = $parent.hasClass('open')
clearMenus()
- !$parent.hasClass('open') && $parent.toggleClass('open')
+ !isActive && $parent.toggleClass('open')
return false
}