2013-07-19 31 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网址的前面。

相关问题