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:
13
js/bootstrap-modal.js
vendored
13
js/bootstrap-modal.js
vendored
@@ -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
|
||||
}
|
||||
|
2
js/tests/unit/bootstrap-modal.js
vendored
2
js/tests/unit/bootstrap-modal.js
vendored
@@ -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')
|
||||
|
Reference in New Issue
Block a user