[英]Why is CSS spinning not working on mobile?
I want to spin the below image to 360 degree and below css applied on that image:我想将下面的图像旋转到 360 度并低于应用于该图像的 css:
<img src="" alt="" />
CSS: CSS:
.image {
position: absolute;
top: 50%;
left: 50%;
width: 120px;
height: 120px;
margin:-60px 0 0 -60px;
-webkit-animation:spin 4s linear infinite;
-moz-animation:spin 4s linear infinite;
animation:spin 4s linear infinite;
}
@-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } }
@-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } }
@keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } }
It's working on desktop well but not on mobile?它在桌面上运行良好,但在移动设备上运行不好吗? If I have done anything wrong?如果我做错了什么?
This works for me both on mobile and desktop.这在移动设备和桌面设备上都适用于我。
.loader {
position: absolute;
width: 120px;
height: 120px;
left: 0; right: 0;
top: 0; bottom: 0;
margin: auto;
max-width: 100%;
max-height: 100%;
overflow: hidden;
-webkit-animation: spin 4s linear infinite;
animation: spin 4s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
Your spin code might be not working because you haven't coded that correctly.您的自旋代码可能不起作用,因为您没有正确编码。 There are some issues in the @keyframes
animation. @keyframes
动画中存在一些问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.