2017-02-07 7 views
0

Ich habe versucht, meine CSS-Typ-Animation für Firefox heute Abend zu reparieren - bisher keinen Erfolg. Die Chrome-Codes funktionieren auch. Was vermisse ich Jungs?CSS-Typ-Animation funktioniert nicht für Firefox

.css-typing 
{ 
    width: 680px; 
    white-space: nowrap; 
    overflow: hidden; 
    -webkit-animation: type 3s steps(50, end); 
    animation: type 3s steps(55, end); 
    -o-animation: type 5s steps(50, end); 
    -moz-animation: type 3s steps(55, end); 
    } 


@keyframes type 
    { 
     from { width: 0; } 
    } 

@-moz-keyframes type 
    { 
     from { width: 0; } 
    } 

@-webkit-keyframes type 
    { 
     from { width: 0; } 
    } 

Die div, die durch diesen Code definiert werden wie folgt aussieht:

<div class='css-typing'>This text will pop up using an typewriting effect</div> 

Hat mein Fehler jemand vor Ort?

+0

Jenseits der Tatsache, dass die 'div' nicht die' .css-Typisierung' haben? – TricksfortheWeb

+0

Tippfehler ... wie erwähnt, es funktioniert auf Chrom so –

Antwort

1

Sie müssen den to Teil des @keyframes Blockes setzen, und Sie müssen auch die Breite des Elements einzustellen: https://jsfiddle.net/yak613/vtdyuju4/

.css-typing { 
    width: 360px; 
    white-space: nowrap; 
    overflow: hidden; 
    -webkit-animation: type 3s steps(50, end); 
    animation: type 3s steps(55, end); 
    -o-animation: type 5s steps(50, end); 
    -moz-animation: type 3s steps(55, end); 
} 


@keyframes type 
    { 
     from { width: 0; } 
     to { width: 360px; } 
    } 

@-moz-keyframes type 
    { 
     from { width: 0; } 
     to { width: 360px; } 
    } 

@-webkit-keyframes type 
    { 
     from { width: 0; } 
     to { width: 360px; } 
    } 
+0

Hmm, das scheint immer noch nicht zu funktionieren =/Meine Firefox-Version ist up-2-Datum. –

+0

Ich habe es in Firefox 51 auf Ubuntu 16.01 getestet, und es hat funktioniert. Bist du sicher, dass du etwas nicht übersiehst? – TricksfortheWeb

+0

Ich überprüfe gerade. Fiddle-Code funktioniert für mich, aber mein Code scheint nichts auf Firefox zu tun. Vielleicht ist es eine Wordpress-Sache, ich bin mir nicht sicher. Versuchen, das herauszufinden. Danke für Ihre Hilfe tho! –

0

W3C empfiehlt für die beste Browser-Unterstützung, dass ein „von“ und einem " bis "sind beide innerhalb @keyframes definiert. Versuchen Sie, Ihren Code zu ändern:

.css-typing 
{ 
    width: 680px; 
    white-space: nowrap; 
    overflow: hidden; 
    -webkit-animation: type 3s steps(50, end); 
    animation: type 3s steps(55, end); 
    -o-animation: type 5s steps(50, end); 
    -moz-animation: type 3s steps(55, end); 
    } 


@keyframes type 
    { 
     from { width: 0; }, 
     to {width:680px} 
    } 

@-moz-keyframes type 
    { 
     from { width: 0; }, 
     to {width:680px} 
    } 

@-webkit-keyframes type 
    { 
     from { width: 0; } 
     to {width:680px} 
    }