All Downloads are FREE. Search and download functionalities are using the official Maven repository.

static.smart-ui.ui-groups.element.dialog-drag.js Maven / Gradle / Ivy

There is a newer version: 1.0.4
Show newest version
(function(){
    /*事件委托*/
    function isOwnOrChildren(target,sources){
        var flag = false;
        for(var i=0;i window.innerWidth-dialog.clientWidth){
                            left = window.innerWidth-dialog.clientWidth;
                        }
                        var top = (e.clientY-tool.attr[attr].startY+tool.attr[attr].eleY);
                        if(top<0){
                            top = 0;
                        }
                        if(top > window.innerHeight-dialog.clientHeight){
                            top = window.innerHeight-dialog.clientHeight;
                        }
                        dialog.style["left"]=left+"px";
                        dialog.style["top"]=top+"px";
                    }
                });
            })(attr,selector);
        },
        init:function(){
            var bodys = document.getElementsByTagName("body");
            if(bodys && bodys.length>0){
                tool.bindDrag("elDialog",".el-dialog .el-dialog__header");
                tool.bindDrag("elMessageBox",".el-message-box .el-message-box__header");
            }else{
                setTimeout(function(){
                    tool.init();
                },300);
            }
        }
    }
    tool.init();
    window.dialogToCenter=function(){
        setTimeout(function () {
            var dialog = document.querySelector(".el-dialog");
            if(!dialog){
                dialog = document.querySelector(".el-message-box");
            }
            if(!dialog){
                return;
            }
            var left = (window.innerWidth-dialog.clientWidth)/2;
            var top = (window.innerHeight-dialog.clientHeight)/3;
            dialog.style["left"]=left+"px";
            dialog.style["top"]=top+"px";
        },10);
    }
})();




© 2015 - 2025 Weber Informatics LLC | Privacy Policy