2017-07-28 44 views
0

我已經在我的rails應用中實現了這個:animated header。一切工作正常,但我想改變標題圖像,並由於某種原因,它不會加載......我已經嘗試了不同的頁面加載圖像相同的語法,它在軌道中工作正常。背景圖像不會加載圖像Ruby on Rails

我該如何做這項工作,我錯過了什麼?

我改變CSS代碼

.header:before { 
    content: ""; 
    width: 100%; 
    height: 100%; 
    position: absolute; 
    top: 0; 
    left: 0; 
    -webkit-backface-visibility: hidden; 
    -webkit-transform: translateZ(0) scale(1.0, 1.0); 
    transform: translateZ(0); 
    background-image: asset-data-url("header_background.jpg"); 
    background-repeat: no-repeat; 
    background-attachment: fixed; 
    background-position: top center; 
    background-color: #1B2030; 
    background-size: cover; 
    -o-background-size: cover; 
    -webkit-background-size: cover; 
    -moz-background-size: cover; 
    animation: grow 60s linear 10ms infinite; 
    transition: all 0.2s ease-in-out; 
    z-index: -2; 
} 

從codepen

.header:before{ 
    content:""; 
    width:100%; 
    height:100%; 
    position:absolute; 
    top:0; 
    left:0; 
    -webkit-backface-visibility: hidden; 
    -webkit-transform: translateZ(0) scale(1.0, 1.0); 
    transform: translateZ(0); 
    background:#1B2030 url(https://unsplash.it/1999/999?image=1063) top center no-repeat; 
    background-size:cover; 
    background-attachment:fixed; 
    animation: grow 60s linear 10ms infinite; 
    transition:all 0.2s ease-in-out; 
    z-index:-2 
} 

回答

0

代碼好吧,我已經想通了!我已經在腳本標記視圖中使用CSS這是它不會加載的原因...我猜資產數據網址只有當它在一個CSS文件中實現時才起作用...