以下是我试图在5秒后从javascript关闭的Twitter Bootstrap
代码段,但我无法做到这一点。请告诉我如何关闭它。
当前用户点击此按钮时关闭:
<button type="button" class="close" style="float: none;" data-dismiss="modal" aria-hidden="true">×</button>
http://bootsnipp.com/snippets/featured/centered-processing-modal
<!-- Static Modal -->
<div class="modal modal-static fade" id="processing-modal" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<div class="text-center">
<img src="http://www.travislayne.com/images/loading.gif" class="icon" />
<h4>Processing... <button type="button" class="close" style="float: none;" data-dismiss="modal" aria-hidden="true">×</button></h4>
</div>
</div>
</div>
</div>
</div>
.modal-static {
position: fixed;
top: 50% !important;
left: 50% !important;
margin-top: -100px;
margin-left: -100px;
overflow: visible !important;
}
.modal-static,
.modal-static .modal-dialog,
.modal-static .modal-content {
width: 200px;
height: 200px;
}
.modal-static .modal-dialog,
.modal-static .modal-content {
padding: 0 !important;
margin: 0 !important;
}
.modal-static .modal-content .icon {
}
答案 0 :(得分:0)
不想为您阅读文档,这里是链接中的文档的快速而肮脏的解决方案。
setTimeout(
function(){
$('#processing-modal button.close').click();
},
5000
);
如果您想要更精细的控制,则必须阅读文档。这是为了在某些数据处理以某种方式结束时完成。这可能以某种方式绑定到自定义属性并触发事件或其他内容。