mirror of
https://github.com/twbs/bootstrap.git
synced 2022-11-09 12:25:43 -05:00
if transitioning collapse, don't start new transition
This commit is contained in:
parent
663e41d74f
commit
cb8dcfcebf
3 changed files with 32 additions and 8 deletions
Binary file not shown.
20
docs/assets/js/bootstrap-collapse.js
vendored
20
docs/assets/js/bootstrap-collapse.js
vendored
|
@ -42,11 +42,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
, show: function () {
|
, show: function () {
|
||||||
var dimension = this.dimension()
|
var dimension
|
||||||
, scroll = $.camelCase(['scroll', dimension].join('-'))
|
, scroll
|
||||||
, actives = this.$parent && this.$parent.find('> .accordion-group > .in')
|
, actives
|
||||||
, hasData
|
, hasData
|
||||||
|
|
||||||
|
if (this.transitioning) return
|
||||||
|
|
||||||
|
dimension = this.dimension()
|
||||||
|
scroll = $.camelCase(['scroll', dimension].join('-'))
|
||||||
|
actives = this.$parent && this.$parent.find('> .accordion-group > .in')
|
||||||
|
hasData
|
||||||
|
|
||||||
if (actives && actives.length) {
|
if (actives && actives.length) {
|
||||||
hasData = actives.data('collapse')
|
hasData = actives.data('collapse')
|
||||||
actives.collapse('hide')
|
actives.collapse('hide')
|
||||||
|
@ -59,7 +66,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
, hide: function () {
|
, hide: function () {
|
||||||
var dimension = this.dimension()
|
var dimension
|
||||||
|
if (this.transitioning) return
|
||||||
|
dimension = this.dimension()
|
||||||
this.reset(this.$element[dimension]())
|
this.reset(this.$element[dimension]())
|
||||||
this.transition('removeClass', 'hide', 'hidden')
|
this.transition('removeClass', 'hide', 'hidden')
|
||||||
this.$element[dimension](0)
|
this.$element[dimension](0)
|
||||||
|
@ -82,9 +91,12 @@
|
||||||
var that = this
|
var that = this
|
||||||
, complete = function () {
|
, complete = function () {
|
||||||
if (startEvent == 'show') that.reset()
|
if (startEvent == 'show') that.reset()
|
||||||
|
that.transitioning = 0
|
||||||
that.$element.trigger(completeEvent)
|
that.$element.trigger(completeEvent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.transitioning = 1
|
||||||
|
|
||||||
this.$element
|
this.$element
|
||||||
.trigger(startEvent)
|
.trigger(startEvent)
|
||||||
[method]('in')
|
[method]('in')
|
||||||
|
|
20
js/bootstrap-collapse.js
vendored
20
js/bootstrap-collapse.js
vendored
|
@ -42,11 +42,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
, show: function () {
|
, show: function () {
|
||||||
var dimension = this.dimension()
|
var dimension
|
||||||
, scroll = $.camelCase(['scroll', dimension].join('-'))
|
, scroll
|
||||||
, actives = this.$parent && this.$parent.find('> .accordion-group > .in')
|
, actives
|
||||||
, hasData
|
, hasData
|
||||||
|
|
||||||
|
if (this.transitioning) return
|
||||||
|
|
||||||
|
dimension = this.dimension()
|
||||||
|
scroll = $.camelCase(['scroll', dimension].join('-'))
|
||||||
|
actives = this.$parent && this.$parent.find('> .accordion-group > .in')
|
||||||
|
hasData
|
||||||
|
|
||||||
if (actives && actives.length) {
|
if (actives && actives.length) {
|
||||||
hasData = actives.data('collapse')
|
hasData = actives.data('collapse')
|
||||||
actives.collapse('hide')
|
actives.collapse('hide')
|
||||||
|
@ -59,7 +66,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
, hide: function () {
|
, hide: function () {
|
||||||
var dimension = this.dimension()
|
var dimension
|
||||||
|
if (this.transitioning) return
|
||||||
|
dimension = this.dimension()
|
||||||
this.reset(this.$element[dimension]())
|
this.reset(this.$element[dimension]())
|
||||||
this.transition('removeClass', 'hide', 'hidden')
|
this.transition('removeClass', 'hide', 'hidden')
|
||||||
this.$element[dimension](0)
|
this.$element[dimension](0)
|
||||||
|
@ -82,9 +91,12 @@
|
||||||
var that = this
|
var that = this
|
||||||
, complete = function () {
|
, complete = function () {
|
||||||
if (startEvent == 'show') that.reset()
|
if (startEvent == 'show') that.reset()
|
||||||
|
that.transitioning = 0
|
||||||
that.$element.trigger(completeEvent)
|
that.$element.trigger(completeEvent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.transitioning = 1
|
||||||
|
|
||||||
this.$element
|
this.$element
|
||||||
.trigger(startEvent)
|
.trigger(startEvent)
|
||||||
[method]('in')
|
[method]('in')
|
||||||
|
|
Loading…
Reference in a new issue