bootboxjs / bootbox

Wrappers for JavaScript alert(), confirm() and other flexible dialogs using Twitter's bootstrap framework

Home Page:http://bootboxjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't handle event ‘hide.bs.modal’ right

felixfb0916 opened this issue · comments

When ‘hide’ events triggered by children of the current dialog before received event "hide.bs.modal",the code below can't worked right.Due to the use of "one",the listener is "off" :

dialog.one('hide.bs.modal', function (e) {
if (e.target === this) {
dialog.off('escape.close.bb');
dialog.off('click');
}
});

This isn't in the current release - what version are you using?

v5.3.2

5.4.0 should fix that - I moved that code into a named function, in part to make the built-in handlers work, so .one() should respect your custom handler.

You can also do something like

bootbox.alert({
    message: 'I have a handler for the hide event!',
    onHide: function() {
        console.log('hide.bs.modal triggered and handled!');
    }
});

Otherwise, I'd need to see a full example.

For reference, this is what's available: http://bootboxjs.com/documentation.html#bb-option-onShow