css关键帧动画未初始化

标签 css animation css-animations

我有一个 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>

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

最佳答案

您同时定义了 animation-timing-function: linear;animation-timing-function: ease-in-out; 并且您在#left-container{ position:aboslute;}

我已经修复了拼写错误并删除了 animation-timing-function: linear; - 这是您想要的吗? Demo

希望这对您有所帮助。

关于css关键帧动画未初始化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16487731/

相关文章:

css - 淡出颜色,在悬停时缩放背景图像

css - 我可以链接到单独文件中的 <head> 标记,以避免在我进行更改时必须更改它们吗?

ios - 在 Swift 中呈现旋转器的动画按钮

javascript - CSS 3D 动画,怎么样?

javascript - 无缝播放新的 css 动画

CSS 动画在执行期间重置

CSS 滑动下划线在 Safari 中不起作用?

html - 为什么 Safari 有时只渲染图像的顶部?

javascript - CSS3 转换 : how to undo a transform operation?

jquery - 元素在 css 动画完成之前消失