easyui datagrid JS加载样式 表头乱

解决方案,找了下资料,加一个遮罩层,提升用户体验。

<script type="text/javascript">
        var width = document.documentElement.clientWidth;
        var height = document.documentElement.clientHeight;

        var html = "<div id='loading' style='position:absolute;left:0;100%;height:" + height + "px;top:0;background:#E0ECFF;opacity:1;filter:alpha(opacity=100);'>";
        //html += "<div style='position:absolute;cursor1:wait;left:" + ((width / 2) - 75) + "px;top:200px;150px;height:16px;padding:12px 5px 10px 30px;";
        //html += "background:#fff url(../themes/default/images/loading.gif) no-repeat scroll 5px 10px;border:2px solid #ccc;color:#000;'>";
        //html += "正在加载,请等待...";
        //html += "</div>";
        html += "</div>";

        window.onload = function () {
            var mask = document.getElementById('loading');
            mask.parentNode.removeChild(mask);
        };
        document.write(html);
        document.write(html);
    </script>
//获取浏览器页面可见高度和宽度
var height = document.documentElement.clientHeight,
    width = document.documentElement.clientWidth;
 
//在页面未加载完毕之前显示的loading Html自定义内容
var html = "<div id='loading' style='position:absolute;left:0;100%;height:" + height + "px;top:0;background:#E0ECFF;opacity:1;filter:alpha(opacity=100);'>";
html += "</div>";
//呈现loading效果
document.write(html);

//监听加载状态改变
document.onreadystatechange = completeLoading;

//加载状态为complete时移除loading效果
function completeLoading() {
    if (document.readyState == "complete") {
        var loadingMask = document.getElementById('loadingDiv');
        loadingMask.parentNode.removeChild(loadingMask);
    }
}
 

天生我材必有用,千金散尽还复来
原文地址:https://www.cnblogs.com/ligenyun/p/7634466.html