【发布时间】:2019-08-22 02:43:46
【问题描述】:
我有一个页面,用户按下按钮来处理数据,这需要 40 秒,所以我想制作一个加载页面我使用 CSS 模板但我不知道如何更改 background colour 调用div 显示我试过这个:
$("#q12").click(function() {
$("#q11").show();
$("#content").css("background", "(136,136,136,0.2)");
});
#q12 是按钮 ID,#q11 是 div(加载动画)ID,#content 是我包装页面内容的 div,我不能简单地替换正文颜色不会覆盖内容,所以我可以在动画中添加什么来隐藏页面并向用户显示某些内容确实正在加载,因为它很小并且位于页面的顶部中心
这是 CSS
#content{
margin-top : 4%;
margin-left : 18%;
margin-right : 2%;
margin-bottom : 6%;
}
.loading{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
height: 70px;
display: flex;
align-items: center;
}
.obj{
width: 9px;
height: 70px;
background: white;
margin: 0 3px;
border-radius: 15px;
animation: loading 0.8s infinite;
}
.obj:nth-child(2){
animation-delay: 0.1s;
}
.obj:nth-child(3){
animation-delay: 0.2s;
}
.obj:nth-child(4){
animation-delay: 0.3s;
}
.obj:nth-child(5){
animation-delay: 0.4s;
}
.obj:nth-child(6){
animation-delay: 0.5s;
}
.obj:nth-child(7){
animation-delay: 0.6s;
}
.obj:nth-child(8){
animation-delay: 0.7s;
}
@keyframes loading {
0%{
height: 0;
}
50%{
height: 70px;
}
100%{
height: 0;
}
}
我之前从未做过预加载器或加载屏幕,当我查看示例时,它们只显示纯 CSS 而不是它的调用方式。
【问题讨论】:
标签: javascript html css