【发布时间】:2023-03-08 07:05:01
【问题描述】:
当我关闭模态(在模态外单击)时,网页仍然是黑暗的,我必须在页面上的某处再次单击它才能再次正常。有谁知道可能是什么问题?
_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 中的“检查元素”中),该页面打开了两个
<div class="modal backdrop in"></div>,而不仅仅是一个。这就是我必须单击两次才能使深色叠加层消失的原因。那么我怎样才能让它只打开一次(而不是两次)?
标签: javascript css ruby-on-rails-3 twitter-bootstrap modal-dialog