在我的页面上,我有一个表格。其中一个单元格内有一个链接。如果点击该链接,我将执行jQuery脚本。例如,如果单击链接,我想显示一个Bootstrap对话框。这可以使用Bootbox.js轻松完成。但是,bootbox没有更新以支持Bootstrap 4。
最初,bootbox甚至不会显示,因为在Bootstrap 3中,显示某些内容的类名为
问题在于类为
最初,bootbox甚至不会显示,因为在Bootstrap 3中,显示某些内容的类名为
in
,但在Bootstrap 4中为show
。我已经修复了这个问题,但这是当前的情况。
调用bootbox.js生成的HTML如下:<div tabindex="-1" class="bootbox modal fade show in" role="dialog" style="display: block;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button class="bootbox-close-button close" aria-hidden="true" type="button" data-dismiss="modal">×</button>
<h4 class="modal-title">Test Title?</h4>
</div>
<div class="modal-body">
<div class="bootbox-body">Test Message</div>
</div>
<div class="modal-footer">
<button class="btn btn-default" type="button" data-bb-handler="cancel"><i class="fa fa-times"></i> Cancel</button>
<button class="btn btn-primary" type="button" data-bb-handler="confirm"><i class="fa fa-check"></i> Confirm</button>
</div>
</div>
</div>
</div>
问题在于类为
modal-header
的中,按钮出现在元素之前。如果这些被交换了,那么问题就解决了,但这就是我需要帮助的地方。我该如何通过bootbox语法来实现呢?我知道我可以暂时删除标题,直到bootbox更新支持bootstrap 4,但我很好奇是否可以做到这一点。
元素之前。如果这些被交换了,那么问题就解决了,但这就是我需要帮助的地方。我该如何通过bootbox语法来实现呢?我知道我可以暂时删除标题,直到bootbox更新支持bootstrap 4,但我很好奇是否可以做到这一点。
以下是我目前的进展:
bootbox.confirm({
className: "show", // where I had to manually add the class name
title: "Test Title?",
message: "Test Message",
buttons: {
cancel: {
label: "<i class='fa fa-times'></i> Cancel"
},
confirm: {
label: "<i class='fa fa-check'></i> Confirm"
}
},
callback: function (result) {
// my callback function
}
});
bootbox.confirm({
className: "show", // where I had to manually add the class name
title: "Test Title?",
message: "Test Message",
buttons: {
cancel: {
label: "<i class='fa fa-times'></i> Cancel"
},
confirm: {
label: "<i class='fa fa-check'></i> Confirm"
}
},
callback: function (result) {
// my callback function
}
});