gpt4 book ai didi

javascript - 模态背景淡入淡出问题与 Bootstrap 模态

转载 作者:行者123 更新时间:2023-11-28 05:33:23 24 4
gpt4 key购买 nike

我试过这个解决方案:https://stackoverflow.com/questions/22056147/bootstrap-modal-backdrop-remaining但没有解决方案我第一次在我的屏幕上尝试 diplay bootstraps 模态它完美地第二次出现但背景更暗(错误)用这两行.

这是我的代码

$(".Ok").modal("show");
$("#alert").on("hidden.bs.modal", function () {
$(this).removeClass("Ok");

});

注意:“Ok”类是我从 json 数据中动态引入的

在第二个模态中单击关闭按钮后,它会显示较暗的叠加背景

它在 html 中显示它

这是我的html

<div id="alert" class="modal fade {{popupBtn1Txt}}">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<p>{{popupErrMsg}}</p>
</div>
<div class="modal-footer text-center">
<button type="button" id="btnc" class="btn btn-default" data-dismiss="modal" aria-hidden="true">{{popupBtn1Txt}}</button>
</div>
</div>
</div>
</div>

{{popupBtn1Txt}} -> “Ok”动态出现,使用 jSON 的 handlebarjs 支持

我不想要黑色覆盖背景

最佳答案

我将 id 称为动态数据,并在弹出窗口使用结束后删除了 id。如果需要,它将再次从 json 响应中动态添加 id,并使用触发器删除覆盖层以及循环

    $("#Ok").modal("show");
$('#Ok').on('hidden.bs.modal', function () {
$('.bg_limegreen').trigger('click');
$(".modal").attr("id","");
});

关于javascript - 模态背景淡入淡出问题与 Bootstrap 模态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38374942/

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