2015-07-03 160 views
0

我必須動態滑動圖像。但它不起作用。 在這裏我的CSS和HTML代碼。動畫CSS不起作用

.demo-section{ 
 
    background: url('http://xxxxx/images/homepages/faces.png') repeat scroll 0 0 transparent; 
 
    -webkit-animation: sliding 60s linear infinite; 
 
    -moz-animation: sliding 60s linear infinite; 
 
    -ms-animation: sliding 60s linear infinite; 
 
    -o-animation: sliding 60s linear infinite; 
 
    animation: sliding 60s linear infinite; 
 
    padding: 55px 0 45px; 
 
}
<div class="demo-section"> 
 
    <h1>Demo Content</h1> 
 
</div>

+6

您是否確實[定義您的動畫](https://developer.mozilla.org/en/docs/Web/CSS/@keyframes)?如果是這樣,那麼發佈該代碼也是一個好主意。 – vvye

回答

1

希望這將解決ū[R問題,試試這個:

.demo-section{ 
    background: url('http://xxxxx/images/homepages/faces.png') no-repeat scroll 0 0 transparent; 
    -webkit-transition: left 3s; /* For Safari 3.1 to 6.0 */ 
    transition: left 3s; 
    left:10px; 
    position:relative; 
    padding: 55px 0 45px; 
} 

div:hover { 
    left: 100px; 
} 

感謝。