【发布时间】:2014-10-21 15:01:04
【问题描述】:
我正在为 div 的 left / top 属性设置动画以将其移动到屏幕上。 (为简洁起见,去掉了前缀)
animation: moveX 10s linear 0s infinite alternate both, moveY 7s linear 0s infinite alternate;
@keyframes moveX {
from { left: 0; } to { left: 100%; }
}
@keyframes moveY {
from { top: 0; } to { top: 100%; }
}
单击 div 后,我添加了一个 CSS 类,它暂停 CSS 动画,并且应该使 div 在屏幕中居中。 CSS:
/* Pause Animation */
-webkit-animation-play-state: paused;
-moz-animation-play-state: paused;
-o-animation-play-state: paused;
animation-play-state: paused;
/* Position Center */
top:50%;
left:50%;
margin: -50px 0 0 -50px;
未应用左侧/顶部值。
如何暂停并保持动画当前状态,更改 div 的位置,然后返回动画。
这里减少了测试用例: http://test.addedlovely.com/pmr/
【问题讨论】:
标签: jquery css css-animations