aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Thornton <[email protected]>2011-08-28 17:32:31 -0700
committerJacob Thornton <[email protected]>2011-08-28 17:32:31 -0700
commitd8d6e400977e80fd50358b821bc643a2a73ca97e (patch)
treee6e47c81bafcaf4c8d2d34424ad68cf4d24bd537
parentf1d17223b8a96aea5e11e289cddc488aaeb40f22 (diff)
downloadbootstrap-d8d6e400977e80fd50358b821bc643a2a73ca97e.tar.xz
bootstrap-d8d6e400977e80fd50358b821bc643a2a73ca97e.zip
listen to delegation for ie
-rw-r--r--examples/assets/js/bootstrap-modal.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/examples/assets/js/bootstrap-modal.js b/examples/assets/js/bootstrap-modal.js
index 858e63c56..c4d917097 100644
--- a/examples/assets/js/bootstrap-modal.js
+++ b/examples/assets/js/bootstrap-modal.js
@@ -107,10 +107,13 @@
, animate = this.$element.hasClass('fade') ? 'fade' : ''
if ( this.isOpen && this.settings.backdrop ) {
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
- .click(function () { that.close() })
.appendTo(document.body)
+ $('body').delegate('.modal-backdrop', 'click.modal.backdrop', function () {
+ that.close()
+ })
} else if ( !this.isOpen && this.$backdrop ) {
this.$backdrop.removeClass('in')
+ $('body').undelegate('click.modal.backdrop')
function removeElement() {
that.$backdrop.remove()
@@ -126,13 +129,13 @@
, escape: function () {
var that = this
if ( this.isOpen && this.settings.closeOnEscape ) {
- $(window).bind('keyup.modal.escape', function ( e ) {
+ $('body').bind('keyup.modal.escape', function ( e ) {
if ( e.which == 27 ) {
that.close()
}
})
} else if ( !this.isOpen ) {
- $(window).unbind('keyup.modal.escape')
+ $('body').unbind('keyup.modal.escape')
}
}