2017-02-11 125 views
0

我試圖使用引導創建彈出窗口,當我單擊打開的登錄窗口按鈕彈出窗口沒有顯示出來。我做了這個觀看教程,並做了同樣的事情。我在這裏找不到錯誤。有人可以幫我弄這個嗎?這是代碼。未打開彈出窗口 - 引導

<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <meta charset="UTF-8"> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <title>images</title> 
    <!-- Latest compiled and minified CSS --> 
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> 

    <!-- Optional theme --> 
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous"> 

    <!-- Latest compiled and minified JavaScript --> 
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> 
</head> 
<body> 
    <div class="container"> 

     <h3>Login Demo</h3> 

     <button type="button" class="btn btn-success" data-toggle="modal" data-target="#popUpWindow">open login window</button> 

     <div class="modal fade" id="popUpWindow"> 
      <div class="modal-dialog"> 
       <div class="modal-content"> 

        <!--header--> 
        <div class="modal-header"> 
         <button type="button" class="close" data-dismiss="modal">&times;</button> 
         <h2 class="modal-title">Login</h2> 
        </div> 

        <!--body (content)--> 
        <div class="modal-body"> 
         <form role="form"> 
          <div class="form-group"> 
           <input type="email" class="form-control" placeholder="Email"> 
          </div> 
          <div class="form-group"> 
           <input type="password" class="form-control" placeholder="Password"> 
          </div> 
         </form> 
        </div> 

        <!--footer (button)--> 
        <div class="modal-footer"> 
         <button class="btn btn-primary btn-block">Login</button> 
        </div> 

       </div> 
      </div> 
     </div> 

    </div> 
</body> 
</html> 
+0

之前已引導JS文件,包括jQuery的。 – makshh

+0

'<腳本 SRC = 「https://code.jquery.com/jquery-3.1.1.min.js」 完整性= 「SHA256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8 =」 crossorigin = 「匿名」>' – makshh

+0

感謝:)有用。 –

回答

0

您應該爲引導腳本添加jQuery以正常工作。 最簡單的方法是添加類似的腳本標籤:

<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script> 

剛剛啓動腳本之前:

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> 
+0

謝謝:)現在我明白了 –

+0

那麼也許你可以標記爲解決? – JChrist