网页延迟加载技术,直接引用以下js到网页文件即可
新建js 文件,吧以下内容粘贴进去,在需要延迟加载的网页头部引用该js文件即可
try {
var height = window.screen.height; var width = window.screen.width; var leftW = width / 2 - 70;
var _html = "<div id='loading' style='z-index:9999;overflow:hidden; position:fixed;left:0;width:100%;min-width: 820px; height:" + height + "px;top:0;background:#EBEBEB;opacity:0.9;filter:alpha(opacity=96);'>\ <div style='position:absolute; overflow:hidden;width:118px;height:33px;
line-height:33px; cursor:wait;left:" + leftW + "px;top:200px;width:auto; padding:1px 6px 1px 36px;\ background: url(../images/loadingx.gif) no-repeat scroll 2px 2px;border:1px solid #C1C1C1;font-size :12px;font-family: Tahoma, Verdana, 宋体; font-weight:
normal;color:#333333;vertical-align: middle;'>\ 加载中请稍后 \ </div></div>";
window.onload = function () { var _mask = document.getElementById('loading'); _mask.parentNode.removeChild(_mask); }
document.write(_html);
}
catch (err) { }