diff --git a/bootbox.js b/bootbox.js index 2d213e96..5f9bfe7c 100644 --- a/bootbox.js +++ b/bootbox.js @@ -429,7 +429,7 @@ // Bootbox event listeners; used to decouple some // behaviours from their respective triggers - if (options.backdrop !== 'static') { + if (options.backdrop === true) { // A boolean true/false according to the Bootstrap docs // should show a dialog the user can dismiss by clicking on // the background. @@ -493,7 +493,7 @@ $(options.container).append(dialog); dialog.modal({ - backdrop: options.backdrop ? 'static' : false, + backdrop: options.backdrop, keyboard: false, show: false }); @@ -1069,7 +1069,13 @@ if (!options.buttons) { options.buttons = {}; } - + //make sure backdrop is either true/false/static + if (!options.backdrop) { + options.backdrop = (options.backdrop === false || options.backdrop === 0) ? false : 'static'; + } else { + options.backdrop = typeof options.backdrop === 'string' && options.backdrop.toLowerCase() === 'static' ? 'static' : true; + } + buttons = options.buttons; total = getKeyLength(buttons); @@ -1228,4 +1234,4 @@ // The Bootbox object return exports; -})); \ No newline at end of file +}));