Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
366 views
in Technique[技术] by (71.8m points)

html - css3 animation not working in chrome

I have a small animation that is working in firefox, but not in webkit browsers. Maybe someone sees the mistake cause i've looked for an hour... It is part of a impress.js presentation, similar to prezi. Thanks!

css:

#its.step.present h5{

display: inline-block;
position:absolute;




 animation: aia2 5s linear infinite alternate;
 -moz-animation: aia2 5s linear infinite alternate;
 -webkit-animation: aia2 5s linear infinite alternate;
 -ms-animation: aia2 5s linear infinite alternate;
 -o-animation: aia2 5s linear infinite alternate;

-moz-animation-delay: 4s;
-webkit-animation-delay: 4s;
-ms-animation-delay: 4s;
-o-animation-delay: 4s;
animation-delay: 4s;


}
@-moz-keyframes aia2{
    0%{

        left:120px;
        -moz-transform:scale(1) rotate(0deg);
        -webkit-transform:scale(1) rotate(0deg);
        -ms-transform:scale(1) rotate(0deg);
        -o-transform:scale(1) rotate(0deg);
        transform:scale(1) rotate(0deg);

        color: red;
    }
    90%{
        left: 580px;

        -moz-transform:scale(1) rotate(2000deg);
        -webkit-transform:scale(1) rotate(2000deg);
        -ms-transform:scale(1) rotate(2000deg);
        -o-transform:scale(1) rotate(2000deg);
        transform:scale(1) rotate(2000deg);

    }
    100%{
        left: 580px;


    }
}

html:

<div id="its" class="step" data-x="850" data-y="3000" data-rotate="90" data-scale="5">
        <p>
            <ul>
                <li>Web Development,</li>
                <li>Web Design,</li>
                <li>Log<h5>o</h5>&nbsp;&nbsp; Design,</li> 
                <li>Web Marketing,</li>
            </ul>

            <ul class="doua">
                <li><h6>e</h6>&nbsp;&nbsp;Commerce,</li>
                <li>CMS (WP, J, D),</li> 
                <li>Cust&nbsp; m Apps</li> 
                <li>and others.</li>
            </ul>
        </p>
    </div>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You have to put the general animation rule after the browser specific ones:

-webkit-animation: aia2 5s linear infinite alternate;
   -moz-animation: aia2 5s linear infinite alternate;
    -ms-animation: aia2 5s linear infinite alternate;
     -o-animation: aia2 5s linear infinite alternate;
        animation: aia2 5s linear infinite alternate; /* this comes last */

And since you have -webkit-animation: aia2, -moz-animation: aia2 etc. you have to set the animation for each browser like:

@-moz-keyframes aia2{
    ...
}

@-webkit-keyframes aia2{
    ...
}
@-o-keyframes aia2{
    ...
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...