Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/59.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 引导模式不显示,仅显示背景_Ruby On Rails_Twitter Bootstrap_Bootstrap Modal - Fatal编程技术网

Ruby on rails 引导模式不显示,仅显示背景

Ruby on rails 引导模式不显示,仅显示背景,ruby-on-rails,twitter-bootstrap,bootstrap-modal,Ruby On Rails,Twitter Bootstrap,Bootstrap Modal,我已经张贴了这之前,但没有人回答我的问题。然而,在尝试了几天之后。我遇到了一些有趣的事情 我的视图代码 <% provide(:title, "Log in") %> <div class="center jumbotron"> <h1> Kaching </h1> <div class = "row" > <div class="col-md-6 col-md-offset-3"> <%= form_fo

我已经张贴了这之前,但没有人回答我的问题。然而,在尝试了几天之后。我遇到了一些有趣的事情

我的视图代码

<% provide(:title, "Log in") %>
<div class="center jumbotron">
<h1> Kaching </h1>
<div class = "row" >
  <div class="col-md-6 col-md-offset-3">
    <%= form_for(:session, url: login_path) do |f| %>

    <%= f.label :logID, "Log ID" %>
    <%= f.text_field :logID %>

    <%= f.label :password %>
    <%= f.password_field :password, class: 'form-control' %>

    <%= f.submit "Log In", class:"btn btn-primary" %>
    <% end %>
  </div>
</div>
</div>
<!-- Trigger the modal with a button -->
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>

<!-- Modal -->
<div id="myModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Modal Header</h4>
      </div>
      <div class="modal-body">
        <p>Some text in the modal.</p>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
      </div>
    </div>

  </div>
</div>
<script type="text/javascript">
    $(window).load(function(){
        $('#myModal').modal('show');
    });
</script>

卡钦
开放模态
&时代;
模态头
模态中的一些文本

关 $(窗口)。加载(函数(){ $('myModal').modal('show'); });
当我包含代码时,加载页面时会出现模式框。但是,当我按下按钮时,我的模式仍然不会出现。我不明白为什么。只有当我在/assets/javascripts文件夹中包含bootstrap.js时,它才会起作用。但是,这会影响我在另一页上实现的选项卡。我尝试只加载bootstrap-modal.js文件,但它也不起作用。请在这方面指导我


谢谢

bootstrap-modal.js需要bootstrap.js才能工作,我在fiddle中检查了代码,您的代码没有问题,你必须包含bootstrap.js才能让modal工作bootstrap.js与我为我的选项卡实现的另一个javascript冲突。我如何才能做到这一点?我建议你打开一个新问题,详细描述问题,并发布相关代码,在这一点上,我不知道其他javascript是什么,我所说的只是猜测,我所说的javascript在script标记中。当我放置在分页链接上时,这是为了保持我的标签在适当的位置。请帮助我。当我包含bootsrap.js文件时,它停止工作