diff options
author | Jacob Thornton <jacobthornton@gmail.com> | 2011-09-11 06:01:16 +0400 |
---|---|---|
committer | Jacob Thornton <jacobthornton@gmail.com> | 2011-09-11 06:01:16 +0400 |
commit | a71d5d8e991eee4073d3312743778b1991cfb650 (patch) | |
tree | d5d8e8b3d8cc565c84a86c1e770f037a32665652 /js/bootstrap-modal.js | |
parent | 235246d6fcc7947d04555205a5f8a242eb3f6b97 (diff) |
add the dhg flavor back
Diffstat (limited to 'js/bootstrap-modal.js')
-rw-r--r-- | js/bootstrap-modal.js | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/js/bootstrap-modal.js b/js/bootstrap-modal.js index 4843d2b727..a7ab252ebc 100644 --- a/js/bootstrap-modal.js +++ b/js/bootstrap-modal.js @@ -59,16 +59,17 @@ this.isShown = true _.escape.call(this) - _.backdrop.call(this) - - this.$element - .appendTo(document.body) - .show() + _.backdrop.call(this, function () { + that.$element + .appendTo(document.body) + .show() - setTimeout(function () { - that.$element.addClass('in').trigger('modal:shown') - that.$backdrop && that.$backdrop.addClass('in') - }, 1) + setTimeout(function () { + that.$element + .addClass('in') + .trigger('modal:shown') + }, 1) + }) return this } @@ -81,7 +82,6 @@ this.isShown = false _.escape.call(this) - _.backdrop.call(this) this.$element.removeClass('in') @@ -89,6 +89,8 @@ that.$element .detach() .trigger('modal:hidden') + + _.backdrop.call(that) } $.support.transition && this.$element.hasClass('fade') ? @@ -106,13 +108,20 @@ var _ = { - backdrop: function () { + backdrop: function ( callback ) { var that = this , animate = this.$element.hasClass('fade') ? 'fade' : '' if ( this.isShown && this.settings.backdrop ) { this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />') .click($.proxy(this.hide, this)) .appendTo(document.body) + + setTimeout(function () { + that.$backdrop && that.$backdrop.addClass('in') + $.support.transition && that.$backdrop.hasClass('fade') ? + that.$backdrop.one(transitionEnd, callback) : + callback() + }) } else if ( !this.isShown && this.$backdrop ) { this.$backdrop.removeClass('in') |