首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何从css动画关键帧中获取图像,以便在完成后保留在页面上

如何从css动画关键帧中获取图像,以便在完成后保留在页面上
EN

Stack Overflow用户
提问于 2016-01-25 06:08:18
回答 1查看 157关注 0票数 2

我只想让iteration-count运行一次,但事后,我希望我的图像无限期地保留在页面上。

是否存在使用css来完成这一任务,或者我是否需要应用javascript方法?

代码语言:javascript
复制
#contact-success-animation {
	width: 100px;
	height: 100px;
	position: relative;
	margin: auto auto;
	-webkit-animation-name: success-animation; /* Chrome, Safari, Opera */
    -webkit-animation-duration: 15s; /* Chrome, Safari, Opera */
    -webkit-animation-iteration-count: 1; /* Chrome, Safari, Opera */
    -webkit-animation-direction: normal; /* Chrome, Safari, Opera */
	animation-name: success-animation;
    animation-duration: 15s;
    animation-iteration-count: 1;
    animation-direction: normal;
}

/* Chrome, Safari, Opera */
@-webkit-keyframes success-animation {
    0%   {background-image: url(""); background-repeat: no-repeat;
background-size: 100% auto; height: 100px; width: 100px;}
    33%  {background-image: url(""); background-repeat: no-repeat;
background-size: 100% auto; height: 100px; width: 100px;}
    66%  {background-image: url(""); background-repeat: no-repeat;
background-size: 100% auto; height: 100px; width: 100px;}
    100% {background-image: url("); background-repeat: no-repeat;
background-size: 100% auto; height: 100px; width: 100px;}
}

/* Standard syntax */
@keyframes success-animation {
    0%   {background-image: url(""); background-repeat: no-repeat;
background-size: 100% auto; height: 100px; width: 100px;}
    33%  {background-image: url(""); background-repeat: no-repeat;
background-size: 100% auto; height: 100px; width: 100px;}
    66%  {background-image: url(""); background-repeat: no-repeat;
background-size: 100% auto; height: 100px; width: 100px;}
    100% {background-image: url(""); background-repeat: no-repeat;
background-size: 100% auto; height: 100px; width: 100px;}
}
代码语言:javascript
复制
<div id="contact-success-animation"></div>

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-01-25 06:30:43

animation-fill-mode: forwards;

此属性将使@-keyframes中的最后一个帧在完成后保持不变。

您可以在这里找到更多信息,MDN

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34986125

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档