Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Thornton <jacobthornton@gmail.com>2011-09-11 05:13:37 +0400
committerJacob Thornton <jacobthornton@gmail.com>2011-09-11 05:13:37 +0400
commit9c76070cbddfd02c034cba9e15960906844b76d0 (patch)
tree2555577c4ccf276f0a8187484b17563311908c73 /js/bootstrap-modal.js
parent57a8672b77a219b99215b781740cc9cf5f7fc1a5 (diff)
rework the transitions for the modal a bit
Diffstat (limited to 'js/bootstrap-modal.js')
-rw-r--r--js/bootstrap-modal.js35
1 files changed, 22 insertions, 13 deletions
diff --git a/js/bootstrap-modal.js b/js/bootstrap-modal.js
index de972a8aa1..81f265710d 100644
--- a/js/bootstrap-modal.js
+++ b/js/bootstrap-modal.js
@@ -59,16 +59,17 @@
this.isShown = true
_.escape.call(this)
- _.backdrop.call(this)
+ _.backdrop.call(this, function () {
- this.$element
- .appendTo(document.body)
- .show()
+ 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,19 +82,19 @@
this.isShown = false
_.escape.call(this)
- _.backdrop.call(this)
this.$element.removeClass('in')
function removeElement () {
+ _.backdrop.call(that)
+
that.$element
- .unbind(transitionEnd)
.detach()
.trigger('modal:hidden')
}
$.support.transition && this.$element.hasClass('fade') ?
- this.$element.bind(transitionEnd, removeElement) :
+ this.$element.one(transitionEnd, removeElement) :
removeElement()
return this
@@ -107,13 +108,21 @@
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')
@@ -123,7 +132,7 @@
}
$.support.transition && this.$element.hasClass('fade')?
- this.$backdrop.bind(transitionEnd, removeElement) :
+ this.$backdrop.one(transitionEnd, removeElement) :
removeElement()
}
}