Before a small circle of page loading animation

Encapsulates a file load.js

The introduction of this document in the head of the head of the page on it

// Get the browser page height and width of visible 
var _PageHeight = document.documentElement.clientHeight, 
    _PageWidth = document.documentElement.clientWidth; 
width // distance calculation block loading (loading boxes at the top and left portions of 215px, 61px height ) 
var _LoadingTop = _PageHeight> 61 is (_PageHeight - 61 is) / 2: 0,? 
    _LoadingLeft _PageWidth => 215 (_PageWidth - 215) / 2:? 0; 
loading the Html // page is not displayed before completion of loading custom content
var _LoadingHtml = '<div id="loadingDiv" style="position:absolute;left:0;width:100%;height:' + _PageHeight + 'px;top:0;background:#f3f8ff;opacity:1;filter:alpha(opacity=80);z-index:10000;"><div style="position: absolute; cursor1: wait; left: ' + _LoadingLeft + 'px; top:' + _LoadingTop + 'px; width: auto; height: 57px; line-height: 57px; padding-left: 50px; padding-right: 5px; background: #fff url(/static/img/loadding.gif) no-repeat scroll 5px 10px; border: 2px solid #95B8E7; color: #696969; font-family:\'Microsoft YaHei\';">页面加载中,请等待...</div></div>';
//呈现loading效果
document.write(_LoadingHtml);

//window.onload = function () {
//    var loadingMask = document.getElementById('loadingDiv');
//    loadingMask.parentNode.removeChild(loadingMask);
//};

// load monitor state change 
document.onreadystatechange completeLoading = (); 

// remove a loaded state when the loading effect Complete 

function completeLoading () { 
	the setTimeout (function () { 
		IF (the document.readyState == "Complete") { 
        	var loadingMask document.getElementById = ( 'loadingDiv'); 
        	loadingMask.parentNode.removeChild (loadingMask); 
    	} 
	}, 1000); 

}

  

Guess you like

Origin www.cnblogs.com/zzc666/p/11124371.html