对google个性主页的拖拽效果的js的完整注释[转]

2019-06-02 23:22:44丽君

        ele.elm.pagePosLeft  =  Util.getOffset(ele.elm,  true );
        ele.elm.pagePosTop  =  Util.getOffset(ele.elm,  false );
    }
     var  nextSib  =  el.elm.nextSibling;
     while  (nextSib) {
        nextSib.pagePosTop  -=  el.elm.offsetHeight;
        nextSib  =  nextSib.nextSibling;
    }
};

// 隐藏Google Ig中间那个table,也就是拖拽的容器,配合show一般就是刷新用,解决一些浏览器的怪癖 
Util.hide  =   function  () {
    Util.rootElement.style.display  =   " none " ;
};
// 显示Google Ig中间那个table,解释同上 
Util.show  =   function  () {
    Util.rootElement.style.display  =   "" ;
};

// 移动时显示的占位虚线框 
ghostElement  =   null ;
// 获取这个虚线框,通过dom动态生成 
getGhostElement  =   function  () {
     if  ( ! ghostElement) {
        ghostElement  =  document.createElement( " DIV " );
        ghostElement.className  =   " modbox " ;
        ghostElement.backgroundColor  =   "" ;
        ghostElement.style.border  =   " 2px dashed #aaa " ;
        ghostElement.innerHTML  =   "   " ;
    }
     return  ghostElement;
};

// 初始化可以拖拽的Element的函数,与拖拽无关的我去掉了 
function  draggable(el) {
     // 公用的开始拖拽的函数 
     this ._dragStart  =  start_Drag;
     // 公用的正在拖拽的函数 
     this ._drag  =  when_Drag;
     // 公用的拖拽结束的函数 
     this ._dragEnd  =  end_Drag;