0
HTML5:CSS animte背景圖像問題
<div id="slideshow">
<div id='animate-area'>
</div>
</div>
的CSS:
body {
margin: 0;
padding: 0;
}
#slideshow {
position: relative;
overflow: hidden;
height: 145px;
}
#animate-area {
height: 100%;
width: 2538px;
position: absolute;
left: 0;
top: 0;
background-image: url('../img/banner.png');
animation: animatedBackground 40s 5s linear infinite;
-ms-animation: animatedBackground 40s linear infinite;
-moz-animation: animatedBackground 40s linear infinite;
-webkit-animation: animatedBackground 30s linear infinite;
}
/* Put your css in here */
@keyframes animatedBackground {
from { left: 0; }
to { left: -1269px; }
}
@-webkit-keyframes animatedBackground {
from { left: 0; }
to { left: -1269px; }
}
@-moz-keyframes animatedBackground {
from { left: 0; }
to { left: -1269px; }
}
的jsfiddle:
jsfiddle.net/cz04c4nx/1
使用這個形象,我需要顯示像,http://jsfiddle.net/5pVr4/6/。我試過了,但對於我在本地主機上運行的url('../img/banner.png')
特定圖像,無法獲取。
你確定ü[R提供的相對路徑。我覺得這是更多的路徑問題。你可以提供你的項目文件夾結構 – Khaleel 2014-09-01 05:50:54
任何人都可以幫助我嗎? – sasi 2014-09-01 05:57:49
在沒有前綴的'animation'中,有一個'5s'的延遲,而前綴的沒有。嘗試刪除。 – qtgye 2014-09-01 06:06:55