1. 程式人生 > >遮罩層

遮罩層

fun idt 遮罩 計算 absolut right add borde spl

html代碼

<!-- loading 層 -->
<div id="loadingDivBack" style="display: none; position: absolute; top: 0; left: 0; width: 100%; op: 0; background: #eeeeee; opacity: 0.7; filter: alpha(opacity=30); z-index: 100;"></div>
<div id="loadingDiv" style="display: none; position: absolute; cursor1: wait; width: auto; height: 57px; line-height: 57px; padding-left: 50px; padding-right: 5px; z-index: 101; background: #fff url(<?php echo SHOP_TEMPLATES_URL;?>/images/loading.gif) no-repeat scroll 5px 10px; border: 2px solid #95B8E7; color: #696969; font-family: \‘Microsoft YaHei\‘; "
>正在提交,請等待...</div>

js代碼

showLoading();
function showLoading() {
        var _PageHeight = $(document).height();//document.documentElement.clientHeight,
        _PageWidth = document.documentElement.clientWidth;
        //計算loading框距離頂部和左部的距離(loading框的寬度為215px,高度為61px)
        var _LoadingTop = $(document).scrollTop() + document.documentElement.clientHeight / 2;//
折疊高度+1/2瀏覽器高度得到當前視圖中間 _LoadingLeft = _PageWidth > 215 ? (_PageWidth - 215) / 2 : 0; $("#loadingDivBack").height(_PageHeight); $("#loadingDiv").css("left", _LoadingLeft + "px"); $("#loadingDiv").css("top", _LoadingTop + "px"); $("#loadingDivBack").show(); $(
"#loadingDiv").show(); }

遮罩層