我的 HTML 中有以下节点结构:
<div id="widget1" class="dojoxFloatingPane dijitContentPane dojoxFloatingPaneFg" title="" role="group" style="position: absolute; top: 82px; left: 231px; width: 984px; height: 276px; z-index: 102;" widgetid="widget1">
<div class="dojoxFloatingPaneTitle" dojoattachpoint="focusNode" role="button" tabindex="0">
<div class="dojoxFloatingPaneCanvas" dojoattachpoint="canvas" style="left: 0px; top: 0px; width: 984px; height: 249px;">
<iframe class="dijitBackgroundIframe" src="javascript:""" role="presentation" style="opacity: 0.1; width: 100%; height: 100%;" tabindex="-1">
我正在尝试使用 Dojo 设置此 FloatingPane 的大小,并使用以下代码。首先,我读入节点 widget1 节点,然后查找 dojoxFloatingPaneTitle 类并将这些节点存储在变量中。然后我读取了 cookie,它成功地在 paneNode 上设置了样式。
var paneNode = dom.byId("widget1");
var canvasNode = query(".dojoxFloatingPaneCanvas", paneNode);
function(){
var wid1saved = dojo.fromJson(cookie("widget1"));
domStyle.set(paneNode, {
left: wid1saved.x + "pt",
top: wid1saved.y + "pt",
width: wid1saved.w + "px",
height: wid1saved.h + "px",
position: "absolute"
});
domStyle.set(canvasNode, {
width: wid1saved.w + "px",
height: wid1saved.h + "px",
backgroundColor: "black"
});
}
它确实设置了外部节点(paneNode)的大小,但内部的画布(canvasNode)没有改变。在调试器中,我可以看到查询确实找到了正确的节点。为什么没有设置 canvasNode 样式的任何想法?
非常感谢