問(wèn)題描述:
一直覺(jué)得jqueryeasyui在IE下的渲染效果不大好,尤其剛進(jìn)入頁(yè)面時(shí)的加載,頁(yè)面會(huì)出現(xiàn)布局錯(cuò)亂,雖然是一閃而過(guò),但是給用戶的體驗(yàn)不好;
可以通過(guò)在頁(yè)面onload時(shí),增加一個(gè)遮罩層,把jqueryeasyui的頁(yè)面渲染過(guò)程遮住,等頁(yè)面加載完后,扔掉遮罩層,顯示頁(yè)面;
解決辦法:
- /*
- 文件說(shuō)明:頁(yè)面加載時(shí)Loading JS
- 文件描述:解決IE或FF下,初始化加載時(shí),頁(yè)面布局亂掉的問(wèn)題,參考:http://283433775./blog/720895
- */
- var width = $(window).width();
- var height = $(window).height();
-
- var html = "<div id='loading' style='position:absolute;left:0;width: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;width:150px;height:16px;padding:12px 5px 10px 30px;";
- html += "background:#fff url(" + _basepath + "Scripts/jquery-easyui-1.4/themes/default/images/loading.gif) no-repeat scroll 5px 10px;border:2px solid #ccc;color:#000;'>";
- html += "正在加載,請(qǐng)等待...";
- html += "</div>";
- html += "</div>";
-
- window.onload = function () {
- var mask = document.getElementById('loading');
- mask.parentNode.removeChild(mask);
- };
- document.write(html);
-
把上面的js保存到文件,再引用到頁(yè)面即可。
|