javascript – Warum wird meine Einstellung für den Animationsfüllmodus nicht wirksam?
女神的闺蜜爱上我
女神的闺蜜爱上我 2017-07-05 10:39:25
0
2
973

.gold_egg_broken{

background: url("../img/animation/goldeggBroke.png");
width: 400px;
height: 400px;
animation: eggbroken 3s;
-webkit-animation-fill-mode:forwards;
-webkit-animation-timing-function: steps(80);

}

@-webkit-keyframes kaputt {

0%{
    background-position: 0 0;
}
90%{
    background-position: 0 -32000px;
}
100%{
    background-position: 0 -32000px;
}

}

Schalten Sie diesen Stil dynamisch auf ein Element um und möchten Sie, dass er im letzten Frame unverändert bleibt. Aber es funktioniert nicht

女神的闺蜜爱上我
女神的闺蜜爱上我

Antworte allen(2)
阿神

webkit前缀去掉,修改如下:

.gold_egg_broken{
    background: url("../img/animation/goldeggBroke.png");
    width: 400px;
    height: 400px;
    animation: eggbroken 3s;
    animation-fill-mode:forwards;
    animation-timing-function: steps(80);
}

既然animation属性起作用了,那么也就是说在该浏览器中相关属性不需要前缀了。animation是一个综合属性,默认的animation-fill-modenone,使用带前缀的属性webkit-animation-fill-mode不能覆盖掉animation-fill-mode,所以需要把前缀去掉。

Ty80

谢邀,
@luckness 已经说的很明白。
另外就是 webkit 这类前缀是为了兼容不同浏览器的不同版本的,
保守一点的写法可以是:

p{
     -webkit-animation-fill-mode: forwards;
        -moz-animation-fill-mode: forwards;
         -ms-animation-fill-mode: forwards;
          -o-animation-fill-mode: forwards;
             animation-fill-mode: forwards;
}
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!