function initialize() {
addcloud(); // is Add a mask to the page
document.onreadystatechange = subSomething; //Listen to the loading status change
}
function addcloud() {
var bodyWidth = document.documentElement.clientWidth;
var bodyHeight = Math .max(document.documentElement.clientHeight, document.body.scrollHeight);
var bgObj = document.createElement("div" );
bgObj.setAttribute( 'id', 'bgDiv' );
bgObj.style.position = "absolute";
bgObj.style.top = "0";
bgObj.style.background = "#000000";
bgObj.style.filter = "progid:DXImageTransform .Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
bgObj.style.opacity = "0.5";
bgObj.style.left = "0";
bgObj.style .width = bodyWidth "px";
bgObj.style.height = bodyHeight "px";
bgObj.style.zIndex = "10000"; //Set its zindex attribute to make this div the largest on the z-axis , there will be no response when the user clicks on anything on the page |
document.body.appendChild(bgObj); //Add mask
var loadingObj = document.createElement("div");
loadingObj.setAttribute ( 'id', 'loadingDiv' );
loadingObj.style.position = "absolute";
loadingObj.style.top = bodyHeight / 2 - 32 "px";
loadingObj.style.left = bodyWidth / 2 "px";
loadingObj.style.background = "url(../img/loading.gif)" ;
loadingObj.style.width = "32px";
loadingObj.style. height = "32px";
loadingObj.style.zIndex = "10000";
document.body.appendChild(loadingObj); //Add loading animation-
}
function removecloud() {
$( "#loadingDiv").remove();
$( "#bgDiv").remove();
}
function subSomething() {
if (document.readyState = = "complete" ) //When the page is loaded, remove the page mask and remove the loading animation -
{
removecloud();
}
}