listen to delegation for ie

This commit is contained in:
Jacob Thornton 2011-08-28 17:32:31 -07:00
parent f1d17223b8
commit d8d6e40097
1 changed files with 6 additions and 3 deletions

View File

@ -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')
}
}