当我关闭模式(在模式外单击)时,网页仍然很暗,我必须再次点击页面上的某个位置才能再次正常显示。任何人都知道问题可能是什么?Rails页面加载模态背景两次?
_post_modal.html.erb
<div id="<%= p.id %>" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<p><h3 id="myModalLabel"><%= p.title %></h3></p>
</div>
<div class="modal-body">
<%= raw(p.link) %>
</div>
</div>
_single_post.html.erb
<% @posts.each do |p| %>
<%= render "post_modal" %>
<% end %>
list.html.erb
<div class="container">
<%= render 'single_post' %>
</div>
application.html.erb
<body>
<%= link_to('Logout user', destroy_user_session_path, :method => :delete) %>
<%= link_to('Logout admin', destroy_admin_session_path, :method => :delete) %>
<%= yield %>
</body>
custom.css.scss
body{
background-image:url('dark_leather.png');
color: #333;
font-family: verdana, arial, helvetica, sans-serif;
line-height: 18px;
}
.container{
vertical-align: center;
}
.modal{
h3{
font-family: 'Josefin Slab', serif;
font-size: 18pt;
font-weight: 400;
color: #34DDDD;
}
}
于是我发现了(从“检查元素”在Chrome),该页面打开两个'
' ,而不只是一个。这是我必须点击两次才能使黑色覆盖层消失的原因。那么我怎样才能让它开放一次(而不是两次)呢? – allegutta