aboutsummaryrefslogtreecommitdiff
path: root/js/bootstrap-carousel.js
diff options
context:
space:
mode:
authorMark Otto <[email protected]>2012-01-08 14:33:52 -0800
committerMark Otto <[email protected]>2012-01-08 14:33:52 -0800
commitac68bc39ff46aec1d4654165eb64c2dc11f5e968 (patch)
treeceab3321ac91d267030639c24e4ab6815c5d84ee /js/bootstrap-carousel.js
parent2c790304393cce3ba7db3b3d5bc9385b1986b838 (diff)
parent5a33c1b96e13a4650a127b0e81a91eb235561170 (diff)
downloadbootstrap-ac68bc39ff46aec1d4654165eb64c2dc11f5e968.tar.xz
bootstrap-ac68bc39ff46aec1d4654165eb64c2dc11f5e968.zip
Merge branch '2.0-wip' of github.com:twitter/bootstrap into 2.0-wip
Diffstat (limited to 'js/bootstrap-carousel.js')
-rw-r--r--js/bootstrap-carousel.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/js/bootstrap-carousel.js b/js/bootstrap-carousel.js
index fa5247c97..c49f89ad8 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
})
}