我希望显示加载div,而我的页面完全加载。CSS旋转功能完美地工作在谷歌Chrome上,但它不能运行IE。
下面是我的CSS代码和html代码。
/*Transparent*/
.tr_loading {
width: 100%;
height: 100%;
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-color: rgba(0,0,0,.5);
}
.tr_loading-wheel {
width: 20px;
height: 20px;
margin-top: -40px;
margin-left: -40px;
position: absolute;
top: 50%;
left: 50%;
border-width: 30px;
border-radius: 50%;
-webkit-animation: spin 1s linear infinite;
-o-animation: spin 1s linear infinite;
animation:spin 1s linear infinite;
}
.style-2 .tr_loading-wheel {
border-style: double;
border-color: #ccc transparent;
}
@-webkit-keyframes spin {
0% {
-webkit-transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(-360deg);
}
}<div class="tr_loading style-2">
<div class="tr_loading-wheel"></div>
</div>
发布于 2017-06-06 07:39:02
下面是供应商前缀代码的示例,并不是所有浏览器都支持。
@-webkit-keyframes spin {
0% {
-webkit-transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(-360deg);
}
}使用标准变式,即:
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(-360deg);
}
}请参阅关于@keyframes on MDN的详细文档。
工作演示:
/*Transparent*/
.tr_loading {
width: 100%;
height: 100%;
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-color: rgba(0,0,0,.5);
}
.tr_loading-wheel {
width: 20px;
height: 20px;
margin-top: -40px;
margin-left: -40px;
position: absolute;
top: 50%;
left: 50%;
border-width: 30px;
border-radius: 50%;
-webkit-animation: spin 1s linear infinite;
-o-animation: spin 1s linear infinite;
animation:spin 1s linear infinite;
}
.style-2 .tr_loading-wheel {
border-style: double;
border-color: #ccc transparent;
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(-360deg);
}
}<div class="tr_loading style-2">
<div class="tr_loading-wheel"></div>
</div>
https://stackoverflow.com/questions/44383862
复制相似问题