I believe this solution will do the trick! Check out the JSFiddle link for a demonstration. The ajax functionality was implemented by simulating a call using a custom Timeout
function.
Some important points to consider - make sure not to overlook setting a height
or width
for the parent div. Since the table is small, it may appear distorted without these dimensions. Additionally, remember to include position:relative
to allow proper spacing for the element with the class .page-loader
.
Feel free to experiment and customize as needed!
HTML:
<div style="position: relative">
<div class="page-loader">
<img src="/Content/loader.gif" style="position:absolute; margin:auto; top:0; left:0; right:0; bottom:0;" width="100" alt="Loading">
</div>
<table>
</table>
</div>
CSS:
.page-loader {
position:absolute;
height:100%;
width:100%;
background:gray;
-ms-opacity:0.5;
opacity:0.5;
z-index:1000000;
display: none;
margin-left: -40px;
margin-top: -19px;
}