當我關閉模式(在模式外單擊)時,網頁仍然很暗,我必須再次點擊頁面上的某個位置才能再次正常顯示。任何人都知道問題可能是什麼?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