如何操作bootstrap的模态对话框,而不是在没有灰色叠加层的情况下将其显示为模态窗口。
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
答案 0 :(得分:2)
$("#myModal").modal({
backdrop: none;
});
参考此讨论:Change the background color in a twitter bootstrap modal?
答案 1 :(得分:2)
您可以尝试使用css,
#myModal .modal-backdrop {background-color: transparent;}
或者还有jquery,
$("#myModal").modal({
backdrop: none;
});
答案 2 :(得分:1)
1)http://jsfiddle.net/ringstaff/Gbm89/14/有一个有效的例子。你所要做的就是添加这行css
.modal-backdrop {background: none;}
2)模态启动后
$('#XXX').modal({show:true});
只需触发下面的代码
$('.modal-backdrop').removeClass("modal-backdrop");
3)将 data-backdrop =“false”添加到,然后Bootstrap将完成剩下的工作。
示例:<div class="modal" id="genericModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="false">