3

I am using BootstrapDialog.show for modals and I want the modal to persist even if there is a click or touch(mobile) event outside the modal ..setting backdrop static works for html is not working for BootstrapDialog.show

BootstrapDialog.show({
        title: 'Logout',
        message: "Do you want to Logout?",
        buttons: [{
            label: 'Cancel',
            action: function (dialog) {
                dialog.close();
            }
        }, {
            label: 'OK',
            action: function (dialog) {
                window.localStorage.removeItem("access_token");
                dialog.close();
                location.href = "login.html";
            }
        }]
    });

I want to disable outside click.

FishMan
  • 127
  • 2
  • 11
  • Basically you just need to update your markup with the data attribute `data-backdrop="static"`. Check [this](http://stackoverflow.com/questions/9894339/disallow-twitter-bootstrap-modal-window-from-closing) similar SO for more information – n0m4d Aug 30 '16 at 12:57
  • @n0m4d - The OP is not asking for bootstrap modal approach, BootstrapDialog is different from bootstrap modal. – DavidDomain Aug 30 '16 at 12:58
  • Good point @DavidDomain! I missed the context, thanks for pointing that out – n0m4d Aug 30 '16 at 13:00
  • 2
    You need to add `closable: false,` . Check out the [github example page](https://nakupanda.github.io/bootstrap3-dialog/) and look for **Dialog closable / unclosable** – DavidDomain Aug 30 '16 at 13:00
  • thanks @DavidDomain it worked – FishMan Aug 30 '16 at 13:23

1 Answers1

2

You should add closable : false to your Bootstrap Dialog.

Abhijeet
  • 4,069
  • 1
  • 22
  • 38