From: Jacob Thornton Date: Fri, 30 Sep 2011 06:38:11 +0000 (-0700) Subject: wait for transition to end before triggering shown event X-Git-Tag: v1.4.0~56 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b2b8a789718d8a2cc3248509a94eee36ead6f504;p=thirdparty%2Fbootstrap.git wait for transition to end before triggering shown event --- diff --git a/js/bootstrap-modal.js b/js/bootstrap-modal.js index 41bb540a16..72b7e35256 100644 --- a/js/bootstrap-modal.js +++ b/js/bootstrap-modal.js @@ -81,17 +81,23 @@ escape.call(this) backdrop.call(this, function () { + var transition = $.support.transition && that.$element.hasClass('fade') + that.$element .appendTo(document.body) .show() - if ($.support.transition && that.$element.hasClass('fade')) { + if (transition) { that.$element[0].offsetWidth // force reflow } that.$element .addClass('in') - .trigger('shown') + + transition ? + that.$element.one(transitionEnd, function () { that.$element.trigger('shown') }) : + that.$element.trigger('shown') + }) return this