我尝试在单击链接时淡化模态,但在模态弹出窗口上出现黑色淡入淡出以下是我的模态和链接代码
点击以下链接模态淡入淡出
<%= 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>
我得到了以下内容
CSS如下
.modal-backdrop { 位置:固定;顶部:0;右:0;底部:0;左:0;z 指数:1040;背景颜色:#00000}
.modal {位置:固定;前10名%; 左:50%;z-index: 1050;}