]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
wait for transition to end before triggering shown event
authorJacob Thornton <jacobthornton@gmail.com>
Fri, 30 Sep 2011 06:38:11 +0000 (23:38 -0700)
committerJacob Thornton <jacobthornton@gmail.com>
Fri, 30 Sep 2011 06:38:11 +0000 (23:38 -0700)
js/bootstrap-modal.js

index 41bb540a168d40dbbe02f93bb1fe983fcca95b34..72b7e35256972dcab1bbd0152e9ed0cdadd85c62 100644 (file)
 
         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