一区二区久久-一区二区三区www-一区二区三区久久-一区二区三区久久精品-麻豆国产一区二区在线观看-麻豆国产视频

js可拖動的后臺界面

// ************************ 拖動 *********************************
    function setDrag(e){
            var drag_flag = true; 
            var begin_x = getX(e);
            //添加蒙板
            createMask();
            //添加半透明拖動條
            createSplitDiv();

    function getX(e){
            if(window.event) e = window.event;
            return (e.x || e.clientX);
    }        

    function createSplitDiv(){
        //半透明的拖動條
        var _top = $doc("topArea").offsetHeight +"px";
        var _left = $doc("dragBar").offsetLeft +"px";;
        var _height = $doc("dragBar").offsetHeight +"px";;

        var splitDivCss="position:absolute;width:6px;height:"+_height+";top:"+_top+";left:"+_left+";cursor:col-
resize;background-color:#cccccc;overflow:hidden;z-index:10010;filter:alpha(opacity=50);opacity:0.5;";
        var _splitDiv = document.createElement("div");
        _splitDiv.id = "splitDiv";
        _splitDiv.style.cssText = splitDivCss;

        document.body.appendChild(_splitDiv);

    }    
    function createMask(){
            try{

                //創建背景
                var rootEl=document.documentElement||document.body;
                var docHeight=((rootEl.clientHeight>rootEl.scrollHeight)?
rootEl.clientHeight:rootEl.scrollHeight)+"px";
                var docWidth=((rootEl.clientWidth>rootEl.scrollWidth)?rootEl.clientWidth:rootEl.scrollWidth)
+"px";
                var 
shieldStyle="position:absolute;top:0px;left:0px;width:"+docWidth+";height:"+docHeight+";background:#cccccc;z-
index:10000;filter:alpha(opacity=0);opacity:0";
                var _shield = document.createElement("div");
                _shield.id = "shield";
                _shield.style.cssText = shieldStyle;
                document.body.appendChild(_shield);
            }catch(e){}
        }
        //拖動時執行的函數
        document.onmousemove = function(e){
            try{
                if(drag_flag){
                        var now_x = getX(e);
                        var _pv = parseInt($doc("splitDiv").style.left)+ now_x - begin_x;
                        $doc("splitDiv").style.left = _pv +"px";
                         begin_x = now_x;
                }else{
                        $doc("leftShow").style.width = $doc("splitDiv").style.left;
                        document.body.removeChild($doc("shield"));
                        document.body.removeChild($doc("splitDiv"));
                        // 調整頁面布局
                        resizePage();
                }
            }catch(e){}
        }

        document.onmouseup = function(){
            try{
                if(drag_flag){
                    //設定拖動條的位置(設定左側的寬度)
                    $doc("leftShow").style.width = $doc("splitDiv").style.left;
                    document.body.removeChild($doc("shield"));
                    document.body.removeChild($doc("splitDiv"));
                    // 調整頁面布局
                    resizePage();
                }
                drag_flag = false;
                begin_x = null;
            }catch(e){}
        }

    }

    if(window.attachEvent){
          window.attachEvent("onload",function(){resizePage();});
          window.attachEvent("onresize",function(){resizePage();});
    }
  if(window.addEventListener){
       window.addEventListener("load",function(){resizePage();},true);
       window.addEventListener("resize",function(){resizePage();},true);
  }
[Ctrl+A 全選 注:如需引入外部Js需刷新才能執行]

JavaScript技術js可拖動的后臺界面,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 亚洲小说另类 | 亚洲欧美在线免费观看 | 久久久久亚洲精品影视 | 国产高清国内精品福利 | 日本欧美一二三区色视频 | 欧美日韩亚洲国产一区二区综合 | 色在线视频观看 | 久久久久久国产精品mv | 国产精品自在线拍 | 精品久久影院 | 加勒比一道本综合 | 在线精品视频免费观看 | 亚洲美女aⅴ久久久91 | 国产免费叼嘿在线观看 | 2021最新国产成人精品免费 | 一区二区三区网站在线免费线观看 | 国产精品七七在线播放 | 久久精品国产亚洲a不卡 | 天堂在线www天堂中文在线 | 国产精品伊人 | 国产91在线精品福利 | 亚洲合集 | 2022免费国产精品福利在线 | 人成精品视频三区二区一区 | 在线观看国产一区二区三区 | 好吊妞视频免费观看va | 国产午夜精品福利久久 | 91久久精品国产91久久性色也 | 伊人国产在线观看 | 国产熟睡乱子伦视频观看软件 | 狠狠色香婷婷久久亚洲精品 | 在线精品国产一区二区 | 91福利国产在线观看 | 亚洲视频在线一区二区 | www日本在线观看 | 欧美人禽交视频免费观看 | 亚洲一区精品在线 | 东方伊人免费在线观看 | 免费播放一区二区三区 | 一区二区中文字幕在线观看 | 国产在线精品一区二区不卡 |