首頁 >web前端 >js教程 >js工具方法彈出蒙版_javascript技巧

js工具方法彈出蒙版_javascript技巧

WBOY
WBOY原創
2016-05-16 17:34:291227瀏覽
複製程式碼 程式碼如下:

//工具方法彈出蒙版 add by dning 2012-11-4
var maskShow = (function () {
   >    var free = false;
    var func = {
        onresize: null,
    fre, Type) {
        if (! mask) {
            initMask();
        }
    🎜>            show(curr, false);
           顯示(遮罩碼, false);
            showSelects(true); //for ie6
            curr = null;
             s] = func[s ];
                func[s] = null;
            }
        } else {
        show(curr, false);
            curr = $(el)[0 ];
          >            rePos();
            mask.style.zIndex = maskShow.zIndexBack || 15;
            curr.style.zIndex = maskShow.zIndexFore || 20;
            show(curr, true);
           // for IE6
if(!free)for(func中的var s){ func [s] = window [s]; window [s] = repos; }
> }
        if (類型 == 0) {
            mask.   mask.style.height = document.body .clientHeight 'px';
            if (el) el.style.position = "固定";
      ;
            mask.style.height = "0px";
if (el) el.style.position = "absolute";
        }
    }; IE6) return;
        var sel = document.getElementsByTagName('select');
        var vis = b ? '可見' : '隱藏';
        for (var i = 0; i           i].currentStyle.visibility != vis) sel[i].style.visibility = vis;
        }
    }
 b) a = a.parentNode;
        return a == b;
    }
    function initMask() {
        /*
        mask=”       */
        mask = document.createElement('div');
        mask.style.cssText = '背景顏色:{$c};邊框:無;位置:絕對;可見性:隱藏;不透明度:{$a};過濾過濾器: alpha(opacity={$A})'.replaceWith({
            c: maskShow.bgColor || '#000',            A: maskShow. bgAlpha ? parseInt(maskShow.bgAlpha * 100) : '50'
        });

     maskShow.mask = mask;
}
    function checkVisib(el) {
        var sty = el.style;
    10000px';
        sty. top = '-10000px';
        sty.visibility = '可見';
         
    function rePos() {
        if (!curr) return;
        var ps = $pageSize('doc');
  enterPos(ps, curr.offsetWidth, curr. offsetHeight) ;
        if (rc.left         setRect (curr, rc);
    }
    function centerPos(ps, cw, ch) {
        return {
   scrollLeft (maskShow .adjustX || 0),
上: ((ps.winHeight - ch) >> 1) ps.scrollTop (maskShow.adjustY || 0)
      el, rect) {
var sty = el.style;
        sty.left = (rect.left || 0) 'px';
     px';
        if (長方形中的「寬度」)
            sty.width = rect. idth 'px'o    }
    function show(el, b) {
           if (!b ) {
            el.style.left = -el.offsetWidth - 100 'px';
           }
    }
})();

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn