當我打開頁面的背景圖像顯示,但回過頭頁面圖像後不顯示在Chrome瀏覽器(Safari中的所有 - OK)回來頁背景圖片顯示不出來,當我遇到菜單
使用回形針
在我看來(上HAML + Rails的一些代碼):
#list-projects
- @projects.each do |project|
.project{:style => "background: url('#{project.photo.url(:preview_16x9)}') no-repeat ;"}
獲取這個網站:
<div id="list-projects">
<div class="project" style="background: url('/system/projects/photos/000/000/001/preview_16x9/franchi.jpg?1392386916') no-repeat ;">
<a href="/projects/1"> </a>
<div class="description">
<h3>Shops number two</h3>
<h4>Square —
305 м<sup>2</sup>.</h4>
</div>
</div>
<div class="project" style="background: url('/system/projects/photos/000/000/002/preview_16x9/franchi.jpg?1392310632') no-repeat ;">
<a href="/projects/2"> </a>
<div class="description">
<h3>Shops number one</h3>
<h4>Square —
305 м<sup>2</sup>.</h4>
</div>
</div>
</div>
UPD:由該代碼生成
導航(導軌,HAML)
%nav#mainmenu
%li{class: current_page?(root_path) && 'active' }
= link_to_unless_current 'Projetcs', root_path
%li{class: current_page?(contacts_path) && 'active' }
= link_to_unless_current 'Contacts', contacts_path
禁用turbolinks寶石後,一切正常。爲什麼turbolinks寶石會這樣做? –
發現這個http://stackoverflow.com/questions/20051244/turbolinks-with-carrierwave-images-as-css-background-image –