SPG*_*SPG 63 css css3 css-animations
我写了一个css3动画,它只执行一次.动画运行良好,但在动画结束时会重置.我怎么能避免这种情况,我想保留结果而不是重置它.
$(function() {
$("#fdiv").delay(1000).addClass("go");
});Run Code Online (Sandbox Code Playgroud)
#fdiv {
width: 10px;
height: 10px;
position: absolute;
margin-left: -5px;
margin-top: -5px;
left: 50%;
top: 50%;
background-color: red;
}
.go {
-webkit-animation: spinAndZoom 1s 1;
}
@-webkit-keyframes spinAndZoom {
0% {
width: 10px;
height: 10px;
margin-left: -5px;
margin-top: -5px;
-webkit-transform: rotateZ(0deg);
}
100% {
width: 400px;
height: 400px;
margin-left: -200px;
margin-top: -200px;
-webkit-transform: rotateZ(360deg);
}
}Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<div id="fdiv"></div>Run Code Online (Sandbox Code Playgroud)
这是演示.
Eri*_*ger 116
加 animation-fill-mode: forwards;
到你的 .go
在动画的最后一次迭代完成后,动画的最终关键帧将继续应用.
http://css-infos.net/property/-webkit-animation-fill-mode
将以下样式添加到您的样式表中:
.go {
/* Already exists */
-webkit-animation: spinAndZoom 1s 1;
/*New content */
-webkit-animation-fill-mode: forwards;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
39599 次 |
| 最近记录: |