Page loading overlay
/** OVERLAY **/
#overlay {
position: fixed;
left: 0;
top: 0;
bottom: 0;
right: 0;
background: #000;
opacity: 0.8;
filter: alpha(opacity=80);
}
#loading {
width: 50px;
height: 57px;
position: absolute;
top: 50%;
left: 50%;
margin: -28px 0 0 -25px;
}
<div id="overlay" style="display:none">
<div id="loading">
<img src="<?php echo get_stylesheet_directory_uri() ?>/img/svg-loaders/tail-spin.svg" alt="Loading, please wait...">
</div>
</div>
(function($){
/** New Overlay EventHandler **/
$('button').click(function(e){
$('#overlay').show();
$(document).ajaxComplete(function(e){
$('#overlay').hide();
});
});
}(jQuery));