我最近开始使用 Dojo 框架,并且必须为网站制作浮动窗格。在google和stackoverflow上搜索后,我遇到了一个很好的例子:
但问题是每次我最小化浮动窗格然后单击底部的小选项卡再次显示它时,窗格的大小都会增加!它也可以在 jsfiddle 示例中看到,尽管您需要重复多次,因为更改类似于 2px。
有人可以帮我解决这种奇怪的行为吗?JavaScript 代码:
dojo.require("dojo.dnd.move");
dojo.require("dojox.layout.FloatingPane");
dojo.ready(function() {
var ParentConstrainedFloatingPane = dojo.declare(dojox.layout.FloatingPane, {
postCreate: function() {
this.inherited(arguments);
this.moveable = new dojo.dnd.move.parentConstrainedMoveable(
this.domNode, {
handle: this.focusNode,
area: "content",
within: true
}
);
}
});
var BoxConstrainedFloatingPane = dojo.declare(dojox.layout.FloatingPane, {
postCreate: function() {
this.inherited(arguments);
this.moveable = new dojo.dnd.move.boxConstrainedMoveable(
this.domNode, {
handle: this.focusNode,
box: {l: 10, t: 10, w: 400, h: 400},
within: true
}
);
}
});
var ConstrainedFloatingPane = dojo.declare(dojox.layout.FloatingPane, {
postCreate: function() {
this.inherited(arguments);
this.moveable = new dojo.dnd.move.constrainedMoveable(
this.domNode, {
handle: this.focusNode,
constraints: function() {
var coordsBody = dojo.coords(dojo.body());
// or
var coordsWindow = {
l: 0,
t: 0,
w: window.innerWidth,
h: window.innerHeight
};
return coordsWindow;
},
within: true
}
);
}
});
var searchboxNode = dojo.byId("searchbox");
var floatingPane = new ParentConstrainedFloatingPane({
title: "A floating pane",
resizable: true,
dockable: true,
//constrainToContainer: true,
style: "position:absolute;top:40px;left:40px;width:160px;height:100px;"
}, searchboxNode);
floatingPane.startup();
});
编辑#1:我已经为它提出了一个官方错误票,可以通过这个链接检查进一步的响应:http: //bugs.dojotoolkit.org/ticket/16598