Dojo Dijit 对话框相对位置。是否可以?

ama*_*ntu 4 dojo dialog position modal-dialog

我想将 Dojo 的 Dijit Dialog 相对于我的 html 元素之一定位。是否可以?如果是。如何?

目前它总是在视口中间显示对话框。

任何人都可以帮助我解决此事吗?

谢谢。

阿玛尔4金图

ace*_*ace 5

我这样做的另一种方法(不是很好,因为我重写了私有方法,但它给了我想要的灵活性):

var d = new Dialog({
    title:"Your Dialog",
    _position:function(){
        if(this.refNode){
            p = Geo.position(this.refNode);
            Style.set(this.domNode,{left:p.x + "px", top:p.y + "px"});
        }
    },

    showAround:function(node){
        this.refNode = node;
        this.show();
    }
});
d.showAround(dojo.byId("someNode"));
Run Code Online (Sandbox Code Playgroud)

此示例使用“dojo/dom-style”作为 Style,使用“dojo/dom-geometry”作为 Geo。