0
我有一個簡單的模式,我想知道如何才能讓模式被關閉,當點擊「X」按鈕或取消按鈕。現在當用戶在模態區域外單擊時。 這裏是我的代碼:如何僅在按下取消按鈕時關閉模式彈出窗口?
<div class="container">
<h2>Modal Example</h2>
<!-- Trigger the modal with a button -->
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>
<!-- Modal -->
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<p>Some text in the modal.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
[Disallow twitter bootstrap modal window from closing]可能出現重複(http://stackoverflow.com/questions/9894339/disallow-twitter-bootstrap-modal-window-from-closing) –