2017-07-28 42 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文件中实现时才起作用...