CSS Keyframe animations safari

扶醉桌前 提交于 2019-12-25 02:44:37

问题


I am having an issue getting keyframe animations to work on either desktop or mobile safari.

My Code.

@keyframes bounce {
  0% {
    transform: scale(1, 1) translateY(0);
  }
  50% {
    transform: scale(1.25, .85) translateY(27px);
  }
  100% {
    transform: scale(1, 1) translateY(0);
  }
}

@-webkit-keyframes bounce {
  0% {
    transform: scale(1, 1) translateY(0);
  }
  50% {
    transform: scale(1.25, .85) translateY(27px);
  }
  100% {
    transform: scale(1, 1) translateY(0);
  }
}

.my-animation {
  animation: bounce 2s infinite;
  -webkit-animation: bounce 2s infinite
}

I have tried setting the animation longhand as well. Works fine in chrome but not working in safari desktop or mobile.


回答1:


You need to add -webkit- to transform as well, so it'll be like:

   transform: scale(1, 1) translateY(0);
   -webkit-transform: scale(1, 1) translateY(0);



回答2:


use -webkit-transform in case of @-webkit-keyframes

Check here http://caniuse.com/#feat=transforms2d



来源:https://stackoverflow.com/questions/30870215/css-keyframe-animations-safari

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!