Bootstrap 4上的静态背景不起作用

时间:2018-10-15 06:54:50

标签: jquery bootstrap-4 bootstrap-modal

我正在实现Bootstrap 4 Modal。模态是手动显示的(不是通过按钮显示的)。

在其文档上,它是:

$('#myModal').modal('show');

或:

$('#myModal').modal({keyboard: true, backdrop: "static", show: false});

这两种情况都不存在,我非常需要它。

这是我的代码:

let myModal = $('#myModal');

myModal.modal({
    keyboard: true,
    backdrop: "static",
    show: false,
}).on("show.bs.modal", function(event) {
    $(this).find('.modal-title').html('Success');
    $(this).find('.modal-body').html('${message}');
    let closeModal = $('<button id="close-modal" type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>');
    $(this).find('.modal-footer').append(closeModal);
}).on('hidden.bs.modal', function(event) {
    $(this).find('.modal-title').html('');
    $(this).find('.modal-body').html('');
    $(this).find('.modal-footer').html('');
});

myModal.modal('show');

如何显示带有选项(键盘,背景和显示)的模式?

0 个答案:

没有答案