CSS вращающаяся анимация работает только в Webkit - PullRequest
4 голосов
/ 04 марта 2012

Я хочу, чтобы элемент вращался на 360 градусов бесконечно. Вот мой код:

.rotate-animation {
  -webkit-animation: rotate 2s linear 0 infinite normal;
  -moz-animation: rotate 2s linear 0 infinite normal;
  -o-animation: rotate 2s linear 0 infinite normal;
  -ms-animation: rotate 2s linear 0 infinite normal;
  animation: rotate 2s linear 0 infinite normal;
}

@-webkit-keyframes rotate {
  from {
    -webkit-transform: rotate(0deg);

  }
  to { 
    -webkit-transform: rotate(360deg);
  }
}

@-moz-keyframes rotate {
  from {
    -moz-transform: rotate(0deg);

  }
  to { 
    -moz-transform: rotate(360deg);
  }
}

@-o-keyframes rotate {
  from {
    -o-transform: rotate(0deg);

  }
  to { 
    -o-transform: rotate(360deg);
  }
}

@-ms-keyframes rotate {
  from {
    -ms-transform: rotate(0deg);

  }
  to { 
    -ms-transform: rotate(360deg);
  }
}

@keyframes rotate {
  from {
    transform: rotate(0deg);

  }
  to { 
    transform: rotate(360deg);
  }
}

Работает только в браузерах Webkit. Что я делаю не так?

Ответы [ 2 ]

5 голосов
/ 04 марта 2012

Вы должны определить секунды с нуля 0s также.как это:

-moz-animation: rotate 2s linear 0s infinite normal;

Вместо этого

-moz-animation: rotate 2s linear 0 infinite normal;

Отметьте это http://jsfiddle.net/srxzF/2/

0 голосов
/ 06 мая 2015

В целях большей безопасности лучший выбор - записать секунды с s во всех случаях.

rotate 2s linear 0s infinite normal;
...