2013-06-01 102 views
0

我有一個常規安裝的boostrap 2.3,並且我的模態工作100%正常,除非您單擊屏幕右上角的X以關閉,褪色不會消失。如果您點擊關閉,或點擊其他任何地方,模式將正確關閉。只有當您點擊標題中的X時。我使用圖片作爲鏈接,而不是按鈕。當我點擊X按鈕時,Bootstrap Modal Fade不會消失


這裏是我使用的代碼:

   <a href="#myModal" role="button" data-toggle="modal"> 

        <!-- Modal --> 
        <div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> 
         <div class="modal-header"> 
         <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×x</button> 
         <h3 id="myModalLabel">Modal header</h3> 
         </div> 
         <div class="modal-body"> 
         <p>One fine body…</p> 
         </div> 
         <div class="modal-footer"> 
         <button class="btn btn-primary">Close</button> 
         </div> 
        </div> 

        <div class="sectionisland"><img src="img/courses/personascenario.png"></div></a> 

的代碼是從http://twitter.github.io/bootstrap/javascript.html#modals複製,你可以看到X在上面,當你點擊按鈕。

+0

您發佈的代碼是正常的。問題一定在其他地方。 – bpoiss

回答

0

你可以試試這個:

<div class="modal-header"> 
    <a class="close" data-dismiss="modal" >&times;</a> 
</div> 
0

您可能需要調用模態手動$( '#myModal')模態( '隱藏')。