0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-01-18 10:52:19 +01:00

wait for transition to end before triggering shown event

This commit is contained in:
Jacob Thornton 2011-09-29 23:38:11 -07:00
parent 2715a1e09e
commit b2b8a78971

10
js/bootstrap-modal.js vendored
View File

@ -81,17 +81,23 @@
escape.call(this) escape.call(this)
backdrop.call(this, function () { backdrop.call(this, function () {
var transition = $.support.transition && that.$element.hasClass('fade')
that.$element that.$element
.appendTo(document.body) .appendTo(document.body)
.show() .show()
if ($.support.transition && that.$element.hasClass('fade')) { if (transition) {
that.$element[0].offsetWidth // force reflow that.$element[0].offsetWidth // force reflow
} }
that.$element that.$element
.addClass('in') .addClass('in')
.trigger('shown')
transition ?
that.$element.one(transitionEnd, function () { that.$element.trigger('shown') }) :
that.$element.trigger('shown')
}) })
return this return this