HTML, CSS, JS 实现弹窗 Loading 效果 - 简单易用
.overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 9999;
}
.loader {
border: 16px solid #f3f3f3;
border-top: 16px solid #3498db;
border-radius: 50%;
width: 120px;
height: 120px;
animation: spin 2s linear infinite;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
//显示loading弹窗
function showLoading() {
document.querySelector('.overlay').style.display = 'block';
}
//隐藏loading弹窗
function hideLoading() {
document.querySelector('.overlay').style.display = 'none';
}
原文地址: https://www.cveoy.top/t/topic/mIWB 著作权归作者所有。请勿转载和采集!