Cai*_*der 7 javascript jquery modal-dialog bootstrap-4
我正在使用bootstrap4 alpha 6 Modal,我得到:
Error: Modal is transitioning
Run Code Online (Sandbox Code Playgroud)
当我尝试通过JavaScript函数再次使用动态数据重新触发相同的模态时,会发生这种情况,如下所示:
function openModal(title, text) {
$('.modal-title').text(title);
$('.modal-body p').text(text);
$('#modalAlert').modal('show');
}
Run Code Online (Sandbox Code Playgroud)
我尝试使用setTimeout函数,但没有像本文中那样工作:https: //github.com/twbs/bootstrap/issues/21687
有什么建议?
小智 0
我也在使用 bootstrap 4 Modal,我的解决方案;
$(document).on('show.bs.modal', '.modal', function (event) {
var zIndex = 1040 + (10 * $('.modal:visible').length);
$(this).css('z-index', zIndex);
setTimeout(function() {
$('.modal-backdrop').not('.modal-stack').css('z-index', zIndex - 1).addClass('modal-stack');
}, 0);
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11552 次 |
| 最近记录: |