2015-01-21 111 views
2

我已經使用Bootstrap 3編寫了以下一段代碼,但不幸的是模式窗口未顯示。我不知道它有什麼問題。請幫忙。 :)莫代爾窗口不顯示

<head> 
    <!-- Loading Bootstrap --> 
    <link href="css/bootstrap.min.css" rel="stylesheet"> 
    <link href="css/custom.css" rel="stylesheet"> 
</head> 
<body> 
    <div class="container"> 
     <div class="row"> 
      <ul class="thumbnails"> 
       <li class="col-lg-4 col-md-4 thumb"> 
        <a class="thumbnail" href="#bell" data-toggle="modal" data-target="#bell"><img src="img/thumbs/1.jpg"></a> 
       </li> 
      </ul> 
     </div> 
    </div> 

    <!-- Modal Windows --> 
    <div id="bell" class="modal hide fade" tabindex="-1"> 
     <div class="modal-dialog"> 
      <div class="modal-content"> 
       <div class="modal-header"> 
        <button type="button" class="close" data-dismiss="modal">x</button> 
        <h3>Title</h3> 
       </div> 
       <div class="modal-body"> 
        <p><img src="img/1.jpg" alt="" class="pull-right">Description</p> 
       </div> 
       <div class="modal-footer"> 
        <button class="btn" data-dismiss="modal">Close</button> 
       </div> 
      </div> 
     </div> 
    </div> 
    <!-- Javascript --> 
    <script src="http://code.jquery.com/jquery-latest.min.js"></script> 
    <script src="js/bootstrap.min.js"></script> 
</body> 
</html> 
+0

是沒有意義的,包括'' bootstrap.js''和'jquery.js'中的'底部'。你最好將'bootstrap.js'移動到底部,* *後移動* jQuery。 – haim770 2015-01-21 08:20:43

+0

您需要再次顯示整個HTML(包括''),因爲它可能包含您的問題的答案。 – haim770 2015-01-21 08:23:45

+0

我編輯了代碼。請再看一下。 :) – Cartoon 2015-01-21 08:26:07

回答

0

您需要在引導之前包含jQuery。

引導檢查的第一行,如果jQuery是加載,它不是瓦亭在DOM準備就緒

if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery"); 
+0

我已經進行了編輯,但它仍然無法正常工作。儘管控制檯也沒有顯示任何錯誤。 – Cartoon 2015-01-21 08:38:49

+0

@ haim770很好的捕獲。 – msohns 2015-01-21 08:41:34

3

你只需從你的語氣容器(#bell)刪除hide類。

由於它已經具有modal類,Bootstrap知道隱藏它直到激活。

Fiddle

+0

謝謝。有效。 :) – Cartoon 2015-01-21 08:39:50

+0

@Cartoon你大概是在看老的Bootstrap v2的例子,因爲v2確實使用'hide',但v3沒有。停止閱讀過時的例子! v3和v2有很大的不同。 – cvrebert 2015-01-21 09:21:48