0

我有一个 css @keyframe 动画我正在尝试启动,但它永远不会开始......我做错了什么?

http://jsfiddle.net/sadmicrowave/VKzXp/

@-webkit-keyframes slideNotificationsHide {
   0%{ width:70%; }
   100%{ width:94%; left:0; right:0; }
}

#left-container{ 
 position:aboslute; 
 top:0px; right:30%; 
 width:70%; height:100%; 
 border:1px solid green; 
 background:#eee; 
}

#left-container:target{ 
    background:green; 
    -webkit-animation: slideNotificationsHide .6s ease-in-out linear forwards; 
    -moz-animation: slideNotificationsHide .6s ease-in-out linear forwards; 
    animation: slideNotificationsHide .6s ease-in-out linear forwards; 
}


<div id='left-container'></div>
<a href="#left-container">click to start animation</a>

注意声明中的background:green;属性/属性#left-container:target。那部分确实有效,所以我知道它:target正在工作;只是不是动画。

4

1 回答 1

1

You have defined both animation-timing-function: linear; and animation-timing-function: ease-in-out; and you also had a typo in the #left-container{ position:aboslute;}

I've fixed the typo and removed animation-timing-function: linear; - is this how you want it ? Demo

Hope this helps.

于 2013-05-10T21:03:25.047 回答