1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-29 08:10:47 +02:00

allow backdrop option to accept "static" option

This commit is contained in:
Jacob Thornton
2011-09-17 14:20:51 -07:00
parent 2cb233319d
commit 7b614cfa01
4 changed files with 15 additions and 20 deletions

13
js/bootstrap-modal.js vendored
View File

@@ -89,7 +89,7 @@
that.$element
.addClass('in')
.trigger('shown')
}, 1)
}, 0)
})
return this
@@ -133,17 +133,19 @@
, animate = this.$element.hasClass('fade') ? 'fade' : ''
if ( this.isShown && this.settings.backdrop ) {
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
if ( this.settings.backdropClickHides ) {
this.$backdrop.click($.proxy(this.hide, this))
.appendTo(document.body)
if ( this.settings.backdrop != 'static' ) {
this.$backdrop.click($.proxy(this.hide, this))
}
this.$backdrop.appendTo(document.body)
setTimeout(function () {
that.$backdrop && that.$backdrop.addClass('in')
$.support.transition && that.$backdrop.hasClass('fade') ?
that.$backdrop.one(transitionEnd, callback) :
callback()
})
}, 0)
} else if ( !this.isShown && this.$backdrop ) {
this.$backdrop.removeClass('in')
@@ -210,7 +212,6 @@
$.fn.modal.defaults = {
backdrop: false
, backdropClickHides: true
, keyboard: false
, show: true
}

View File

@@ -137,7 +137,7 @@ $(function () {
$.support.transition = false
var div = $("<div id='modal-test'></div>")
div
.modal({backdrop:true, backdropClickHides:false})
.modal({backdrop: 'static'})
.modal("show")
.bind("shown", function () {
equal($('.modal-backdrop').length, 1, 'modal backdrop inserted into dom')