我在動畫div的左/頂部屬性以在屏幕上移動它。 (前綴爲簡潔,刪除)CSS動畫:暫停和更改位置
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%; }
}
在點擊我添加了一個CSS類暫停CSS動畫,應集中在屏幕的股利股利。 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/
添加動畫沒有失去div的位置,所以當類被刪除它跳回到起點。 – addedlovely 2014-08-27 21:53:46