I am using the following to show a loading image when something takes time to load.
<div class="divLoading"></div>
JS:
$("body").on({
ajaxStart: function () {
$(this).addClass("loading");
},
ajaxStop: function () {
$(this).removeClass("loading");
}
});
CSS
.divLoading {
display: none;
position: fixed;
z-index: 1000;
top: 0;
left: 0;
height: 100%;
width: 100%;
background: rgba( 255, 255, 255, .8 )
url('../../Images/ajax-loader.gif')
50% 50%
no-repeat;
}
body.loading {
overflow: hidden;
}
body.loading .divLoading {
display: block;
}
But this is not working for the 1st time the page is loaded. I want to show this loading image as soon as I log in to my site, until the content of the page is loaded completely.Can you please help me on it. Thanks.