[英]Spinner not spinning
I have a spinner that I am using for a long running operation but I cannot get it to spin. 我有一个旋转器,用于长时间运行,但是无法旋转。 I have read the other SO questions related to this but none of them seem to get my scenario working.
我已经阅读了与此相关的其他SO问题,但是似乎没有一个使我的方案起作用。
I have the following HTML 我有以下HTML
<div class="ms-BasicSpinner">
<div class="ms-Spinner">
<div class="ms-Spinner-circle ms-Spinner--large"></div>
<div class="ms-Spinner-label">Creating...</div>
</div>
</div>
and CSS 和CSS
.ms-Spinner > .ms-Spinner-circle.ms-Spinner--large {
width: 28px;
height: 28px;
}
.ms-Spinner > .ms-Spinner-circle {
margin: auto;
box-sizing: border-box;
border-radius: 50%;
width: 100%;
height: 100%;
border: 1.5px solid #c7e0f4;
border-top-color: #0078d7;
-webkit-animation: ms-Spinner-spin 1.3s infinite cubic-bezier(.53, .21, .29, .67);
animation: ms-Spinner-spin 1.3s infinite cubic-bezier(.53, .21, .29, .67);
}
.ms-Spinner > .ms-Spinner-label {
color: #0078d7;
margin-top: 10px;
text-align: center;
}
.ms-BasicSpinner .ms-Spinner {
display: inline-block;
margin: 10px 0;
}
I also have to following JSFiddle https://jsfiddle.net/20ufspze/ 我还必须遵循JSFiddle https://jsfiddle.net/20ufspze/
What am I missing to get the spinner to spin? 我缺少让微调器旋转的功能吗?
Any help much appreciated 任何帮助,不胜感激
Thanks in advance 提前致谢
You apply the cubic bezier function to a rotation to get the desired effect. 将三次贝塞尔曲线功能应用于旋转以获得所需的效果。 Adapting the bottom element here you can rotate the blue part with:
在此处调整底部元素,您可以使用以下方法旋转蓝色部分:
@-webkit-keyframes ms-Spinner-spin {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@keyframes ms-Spinner-spin {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
And by rewriting the cubic-bezier
part as: 并通过将
cubic-bezier
部分重写为:
-webkit-animation: ms-Spinner-spin 1.3s infinite cubic-bezier(.53, .21, .29, .67);
animation: ms-Spinner-spin 1.3s infinite cubic-bezier(.53, .21, .29, .67);
Best practice to animate any HTML
component is use animation keyframes in CSS. 动画任何
HTML
组件的最佳实践是在CSS中使用动画关键帧。
@keyframes anim {
from {
transform: rotate(0deg);
-webkit-transform: rotate(0deg);
}
to {
transform: rotate(360deg);
-webkit-transform: rotate(360deg);
}
}
...
.ms-Spinner > .ms-Spinner-circle {
margin: auto;
box-sizing: border-box;
border-radius: 50%;
width: 100%;
height: 100%;
border: 1.5px solid #c7e0f4;
border-top-color: #0078d7;
animation: anim 1.3s infinite;
}
...
Fiddle Link : https://jsfiddle.net/8Ly697ne/ 小提琴链接: https : //jsfiddle.net/8Ly697ne/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.