CSS Animation works in Chrome, but not in FireFox

I have the following code at http://jsfiddle.net/4LPSD/

It works in Chrome (version 35.0.1916.153), but not in Firefox (version 30.0).

/******** HTM **********************/
<div class="container">
     <h3>Animated button</h3>
     <button class="btn btn-lg btn-warning"><span class="glyphicon glyphicon-refresh     glyphicon-refresh-animate"></span> Loading...</button>
</div>


/******* CSS **********************/
/* Latest compiled and minified CSS included as External Resource*/

/* Optional theme */
@import url('http://getbootstrap.com/dist/css/bootstrap.css');

.glyphicon-refresh-animate {
    -animation: spin .7s infinite linear;
    -webkit-animation: spin2 .7s infinite linear;
}

@-webkit-keyframes spin2 {
    from { -webkit-transform: rotate(0deg);}
    to { -webkit-transform: rotate(360deg);}
}

@keyframes spin {
    from { transform: scale(1) rotate(0deg);}
    to { transform: scale(1) rotate(360deg);}
}

Does anyone know what is wrong?

I am trying to rotate the image icon.

+4
source share
3 answers

You need to include the Mozilla prefix and remove the hyphen before animation:

.glyphicon-refresh-animate {
  animation: spin .7s infinite linear;
  -webkit-animation: spin2 .7s infinite linear;
  -moz-animation: spin2 .7s infinite linear;
}

@-moz-keyframes spin2 {
  from { -moz-transform: rotate(0deg);}
  to { -moz-transform: rotate(360deg);}
}
+4
source

Thank you for your responses.

I use the -moz option and remove the "-" of -animation character

This is the final code:

/ *********** HTML ********************** > /

<div class="container">
     <h3>Animated button</h3>
    <button class="btn btn-lg btn-warning">
        <span class="glyphicon glyphicon-refresh glyphicon-refresh-animate"></span>
        Loading...
    </button>
</div>

/ *********** CSS ********************* > /

/* Latest compiled and minified CSS included as External Resource*/

/* Optional theme */
@import url('http://getbootstrap.com/dist/css/bootstrap.css');

.glyphicon-refresh-animate {
    -moz-animation: spin-moz .7s infinite linear;
    -webkit-animation: spin-webkit .7s infinite linear;
    animation: spin .7s infinite linear;
}

@-moz-keyframes spin-moz {
  from { -moz-transform: rotate(0deg);}
  to { -moz-transform: rotate(360deg);}
}

@-webkit-keyframes spin-webkit {
    from { -webkit-transform: rotate(0deg);}
    to { -webkit-transform: rotate(360deg);}
}

@keyframes spin {
    from { transform: scale(1) rotate(0deg);}
    to { transform: scale(1) rotate(360deg);}
}
+4

, -animation, .

+2
source

Source: https://habr.com/ru/post/1546692/


All Articles