Fernando_Jr
Fernando_Jr

Reputation: 430

CSS Animation works in Chrome, but not in FireFox

I have the following code in 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);}
}

Anybody knows whats wrong?

I'm trying to rotate a picture icon.

Upvotes: 4

Views: 3539

Answers (3)

Fernando_Jr
Fernando_Jr

Reputation: 430

Thanks for your answers.

I use the parameter -moz and remove the caracter "-" of -animation

This is 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);}
}

Upvotes: 4

roemel
roemel

Reputation: 3297

As Niet the Dark Absol already said, you have to remove the dash before -animation and it will work. See the updated fiddle

Upvotes: 2

Robert Messerle
Robert Messerle

Reputation: 3032

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);}
}

Upvotes: 4

Related Questions