diff options
| author | Jacob Thornton <[email protected]> | 2011-09-17 14:20:51 -0700 |
|---|---|---|
| committer | Jacob Thornton <[email protected]> | 2011-09-17 14:20:51 -0700 |
| commit | 7b614cfa01eccfef02d85f2f82e0b13023ce7baa (patch) | |
| tree | 7c171122a69ae1ca66c56eb05597e2f89bc30cac /js | |
| parent | 2cb233319da422c9f003e8687d686e96a92be489 (diff) | |
| download | bootstrap-7b614cfa01eccfef02d85f2f82e0b13023ce7baa.tar.xz bootstrap-7b614cfa01eccfef02d85f2f82e0b13023ce7baa.zip | |
allow backdrop option to accept "static" option
Diffstat (limited to 'js')
| -rw-r--r-- | js/bootstrap-modal.js | 13 | ||||
| -rw-r--r-- | js/tests/unit/bootstrap-modal.js | 2 |
2 files changed, 8 insertions, 7 deletions
diff --git a/js/bootstrap-modal.js b/js/bootstrap-modal.js index 98e5d4301..d3e293ca8 100644 --- a/js/bootstrap-modal.js +++ b/js/bootstrap-modal.js @@ -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 } diff --git a/js/tests/unit/bootstrap-modal.js b/js/tests/unit/bootstrap-modal.js index 69e720f0f..be6babeef 100644 --- a/js/tests/unit/bootstrap-modal.js +++ b/js/tests/unit/bootstrap-modal.js @@ -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') |
