【发布时间】:2017-04-26 20:02:39
【问题描述】:
我正在使用 bootbox.confirm 进行 ajax 调用,我得到了确认框,但我的屏幕是灰色的,我无法选择任何内容。
这是它的样子:
我的第一个想法是我的脚本可能在_Layout 中被引用错误,但我不确定:
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
捆绑包
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js",
"~/Scripts/moment.js",
"~/Scripts/bootstrap-datetimepicker.js",
"~/Scripts/jquery-ui.js",
"~/Scripts/Scripts.js"
);
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/bootbox.js",
"~/Scripts/respond.js"));
当我在这里检查时:
<body class="modal-open">
<div class="modal-backdrop fade in"></div>
<div class="modal-dialog">...</div>
这是我的脚本:
$(document).ready(function () {
var table = $("#Table").DataTable();
$("#Table.js-delete").on("click",
function () {
var link = $(this);
$("body").removeClass("modal-open");
bootbox.confirm("Are you sure you want to delete this?",
function (result) {
$(".modal-backdrop").remove();
if (result) {
$.ajax({
url: "/api/Informations/" + $(this).attr("data-id"),
method: "DELETE",
success: function () {
table.row(link.parents("tr")).remove().draw();
link.parents("tr").remove();
}
});
}
});
});
});
【问题讨论】:
-
这几乎看起来像是一个 z-index 的东西,所有东西都同时出现,而且只是乱序
-
@Keith 你有什么推荐的?
-
bootstrap.css 中的@Keith..
.modal-backdrop的类的 z-index 为 1040 -
jQuery UI 和 Bootbox 通常不能很好地配合使用,因为它们的一些 CSS 类和 JavaScript 函数会发生冲突。我建议使用其中一个,或者查看jQuery UI Bootstrap(尽管有一段时间没有更新)。
标签: c# jquery asp.net-mvc bootbox