mirror of
https://github.com/twbs/bootstrap.git
synced 2024-11-29 11:24:18 +01:00
listen to delegation for ie
This commit is contained in:
parent
f1d17223b8
commit
d8d6e40097
9
examples/assets/js/bootstrap-modal.js
vendored
9
examples/assets/js/bootstrap-modal.js
vendored
@ -107,10 +107,13 @@
|
|||||||
, animate = this.$element.hasClass('fade') ? 'fade' : ''
|
, animate = this.$element.hasClass('fade') ? 'fade' : ''
|
||||||
if ( this.isOpen && this.settings.backdrop ) {
|
if ( this.isOpen && this.settings.backdrop ) {
|
||||||
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
|
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
|
||||||
.click(function () { that.close() })
|
|
||||||
.appendTo(document.body)
|
.appendTo(document.body)
|
||||||
|
$('body').delegate('.modal-backdrop', 'click.modal.backdrop', function () {
|
||||||
|
that.close()
|
||||||
|
})
|
||||||
} else if ( !this.isOpen && this.$backdrop ) {
|
} else if ( !this.isOpen && this.$backdrop ) {
|
||||||
this.$backdrop.removeClass('in')
|
this.$backdrop.removeClass('in')
|
||||||
|
$('body').undelegate('click.modal.backdrop')
|
||||||
|
|
||||||
function removeElement() {
|
function removeElement() {
|
||||||
that.$backdrop.remove()
|
that.$backdrop.remove()
|
||||||
@ -126,13 +129,13 @@
|
|||||||
, escape: function () {
|
, escape: function () {
|
||||||
var that = this
|
var that = this
|
||||||
if ( this.isOpen && this.settings.closeOnEscape ) {
|
if ( this.isOpen && this.settings.closeOnEscape ) {
|
||||||
$(window).bind('keyup.modal.escape', function ( e ) {
|
$('body').bind('keyup.modal.escape', function ( e ) {
|
||||||
if ( e.which == 27 ) {
|
if ( e.which == 27 ) {
|
||||||
that.close()
|
that.close()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else if ( !this.isOpen ) {
|
} else if ( !this.isOpen ) {
|
||||||
$(window).unbind('keyup.modal.escape')
|
$('body').unbind('keyup.modal.escape')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user