<style>
.mask{
width: 100%;
height: 100%;
position: fixed;
top:0;
left: 0;
display: none;
background-color: rgba(0, 0, 0, 0.6);
}
.mask .loading {
width: 200px;
height: 100px;
background-color: #fff;
margin: 150px auto;
text-align: center;
line-height: 100px;
}
</style>
function showLoading() {
document.getElementById("mask").style.display = "block";
}
function closeLoading() {
document.getElementById("mask").style.display = "none";
}
<div class="mask" id="mask">
<div class="loading">
Loading...
</div>
</div>