Twitter引导模式在点击link_to时淡出,但模式上出现黑色淡入淡出

时间:2013-04-17 18:01:01

标签: ruby-on-rails-3 twitter-bootstrap modal-dialog fade

我尝试在点击链接时淡化模态,但在模态弹出窗口中出现黑色淡入淡出以下是我的模态和链接代码

点击以下链接模式淡出

 <%= link_to 'New Trade','#myModal', :class => 'btn',:style => 'float:right;', :role => 'button', :data =>{ :toggle => 'modal', :keyboard => true, :backdrop => true } %>   

以下是模态代码

<div id="myModal" class="modal fade" tabindex="1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" keyboard="true">
    <%= simple_form_for @trade_category, :url => create_trade_category_path(@trade_category), :html => { :class => 'form_height'} do |f| %>
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h3 id="myModalLabel">New Trade Category</h3>
      </div>
      <div class="modal-body">
          <%= f.input :name,:lable => false, :autofocus => true, :placeholder =>"Trade category name", :class=> 'input-block-level' %>
      </div>
      <div class="modal-footer">
        <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
        <%= f.submit "Create Trade category", :class=> "btn btn-primary" %>
      </div>
    <% end %>
  </div>

我得到了以下结果 enter image description here

CSS在

之下

.modal-backdrop {   位置:固定;   顶部:0;   右:0;   底部:0;   左:0;   z-index:1040;   background-color:#00000}

.modal {   位置:固定;   前10名%;   左:50%;   z-index:1050;}

1 个答案:

答案 0 :(得分:0)

问题解决了在应用程序文件中父div导航栏位置是固定的所以我删除了固定的位置,现在它正常工作。