gpt4 book ai didi

javascript - 使用自定义对话框时如何关闭引导箱

转载 作者:行者123 更新时间:2023-12-03 13:11:11 25 4
gpt4 key购买 nike

我正在使用 bootbox显示对话框。

如果我使用 bootbox.confirm , bootbox.alertbootbox.prompt , 按 escape 时键或单击对话框外部,对话框按预期关闭

但是当使用 bootbox.dialog ,当我在对话框外单击或按 escape 时键,对话框没有关闭,如何让它像其他对话框一样?

var box = bootbox.dialog({
show: false,
backdrop: true,
animate: false,
title: 'Bla',
message: 'bla bla bla',
buttons: {
cancel: {
label: 'Cancel',
className: 'btn-warning'
},
save: {
label: 'Parse',
className: 'btn-success',
callback: function () {
// handling with ajax
return false;
}
}
}
});
box.modal('show');

最佳答案

这应该这样做。请注意,这仅在 v3 上进行了测试。使用 Bootstrap 2.3.2

$(document).on('click', '.modal-backdrop', function (event) {
bootbox.hideAll()
});

关于javascript - 使用自定义对话框时如何关闭引导箱,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26756500/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com