/*
文件说明:页面加载时Loading JS
文件描述:解决IE或FF下,初始化加载时,页面布局乱掉的问题
*/
将以下代码粘贴到js文件中,页面直接导入该js文件即可
var width = $(window).width(); var height = $(window).height(); var html = "<div id='loading' class='panel-body' style='z-index:1000;position:absolute;left:0;width:100%;height:" + height + "px;top:0;'>"; html += "<div class='panel-header panel-loading' style='position:absolute;cursor1:wait;left:" + ((width / 2) - 100) + "px;top:200px;width:150px;height:16px;padding:5px 5px 10px 30px;font-size:12px;"; html += "border:3px solid #ccc;'>"; html += "正在加载,请等待..."; html += "</div>"; html += "</div>"; document.write(html); function closes() { $("#loading").fadeOut("fast", function () { $(this).remove(); }); } var pc; $.parser.onComplete = function () { if (pc) clearTimeout(pc); pc = setTimeout(closes, 1000); } |