我正在使用MVC
应用程序开发Bootstrap
。我通过Jquery调用Bootstrap PopUp窗口。
这是我的电话
<div style="float:left;width:100%;height:30px;" class="Sees">
<img class="btnNuevoMsg" src="~/Content/Images/NuevoMsg.png" onclick="New()" />
</div>
在New()函数上,我进行了一些验证。取决于此验证,我可以重定向到另一个视图,或者调用Controller方法,该方法返回我在Bootstrap标记中呈现的局部视图。
这是我的引导标签。
<div class="modal fade" id="myModalLog" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
</div>
我的Jquery函数就是这样。
$.ajax(
{
type: "POST",
url: '@Url.Action("ShowLogUser","Home")',
//data: { search: _search },
success: function (result) {
$('#myModalLog').html(result);
$('#myModalLog').modal();
// $('#myModalLog').modal('toggle');
// $('#myModalLog').modal('show');
},
error: function (req, status, error) {
}
});
它工作正常...
我发现的问题是我不能使用
data-toggle =“ modal”
通过Jquery ...
当用户在Windows之外单击时,我不想关闭PopUp Windows。
我已经尝试使用示例中所示的
$('#myModalLog').modal('toggle');
,但是它不起作用。如何在Jquery中使用ths属性?
谢谢
最佳答案
像这样将背景属性添加到模型中
$("#myModalLog").modal({backdrop: "static"});
这里的例子
https://www.w3schools.com/bootstrap/tryit.asp?filename=trybs_ref_js_modal_backdrop&stacked=h