2013-07-19 83 views
-1

我嘗試使用modal插件,但沒有效果。我看到了代碼,該位置沒問題。所以在我的代碼中有一些東西,但是我看到了turtal。所以幫助我,給我一些建議。爲什麼我的引導程序無法工作

<!DOCTYPE HTML> 
    <html lang="en"> 
    <head> 
     <meta charset="UTF-8"> 
     <title></title> 
     <link media="all" rel="stylesheet" href="docs/assets/css/bootstrap.css" type="text/css" /> 
     <link media="all" rel="stylesheet" href="docs/assets/css/bootstrap-responsive.css" type="text/css" /> 
     <script src="sgsheg/jquery-1.10.0.min.js" type="text/javascript"></script> 
     <script src="sgsheg/bootstrap.min.js" type="text/javascript"></script> 
     <script src="js/bootstrap-modal.js" type="text/javascript"></script> 
    </head> 
    <body> 
     <div class="modal hide fade"> 
     <div class="modal-header"> 
      <button type="button" class="close" data-dismiss="model" aria-hidden="true" >&times;</button> 
      <h3>Modal header</h3> 
     </div> 
     <div class="modal-body"> 
      <p>One fine body...</p> 
     </div> 
     <div class="modal-footer"> 
      <a href="#" class="btn">Close</a> 
      <a href="#" class="btn btn-primary">Save changes</a> 
     </div> 
    </div> 
    </body> 
    </html> 

enter image description here

+2

究竟是什麼錯誤?你的例子似乎很好。你忘了在你的「關閉」和「保存更改」按鈕上放置'data-dismiss =「modal」'?請注意,您在「x」關閉按鈕 – Ian

+7

「但我看到的turtal」上拼寫錯了'data-dismiss =「model」'。你看到烏龜? – j08691

+1

@ j08691:重新標記爲[標識](http://stackoverflow.com/tags/logo)的問題? –

回答

1

你缺少toggle [R

<!-- Button to trigger modal --> 
<a href="#myModal" role="button" class="btn" data-toggle="modal">Launch demo modal</a> 

或者,你可以啓動它手動

$(function(){ 
    $(".modal").modal("show"); //shows the modal on document ready 
    //$(".some-class").on('click' , function() { //this is if you want to fire it with a button 
    // $(".modal").modal("show");    //of course you don't have to use both data-* 
    //}           //and javascript, choose one. 
} 

這取決於你必須做的事;

如果你有showmodaldoc準備就緒,使用javascript,如果不是隻使用html代替。

UPDATE 僅包括bootstrap.jsbootstrap-modal,不togheter。

0

事實證明,百里香葉引擎需要的腳本SRC定義指定爲

th:src="@{...}" 

所以儘量

th:src="@{sgsheg/jquery-1.10.0.min.js}" 
th:src="@{sgsheg/bootstrap.min.js}" 

此外,你真的不需要包括引導模態.js,因爲它已經在bootstrap.min.js

如果你已經定義了你的resourceHandler as "/sgsheg/**" and "/js/**"那麼你需要將斜線(/)放在src網址的前面。

相關問題