在此链接的示例中,有一个dijit布局的contentpanes。最大化dijit布局BorderContainer
有没有一种方法,以最大限度地提高中心窗格覆盖整个布局。
我已使用以下给中央面板和id id="center"
dijit.ById("center").domNode.style.width='100%'
//and
dijit.ById("center").resize({w:1000,h:1000});
在此链接的示例中,有一个dijit布局的contentpanes。最大化dijit布局BorderContainer
有没有一种方法,以最大限度地提高中心窗格覆盖整个布局。
我已使用以下给中央面板和id id="center"
dijit.ById("center").domNode.style.width='100%'
//and
dijit.ById("center").resize({w:1000,h:1000});
要调整中心布局后,知道您设置了一个id为这最后的,(id="center"
),你可以使用dojo/dom-style
尝试为窗格布局设置新的窗口宽度和高度,然后将样式应用于中间窗格,此处的preobleme也是当您调整窗口大小时窗格应该具有初始样式,所有你需要做的就是执行resi查懋每个窗口resize事件..
你可以看到波纹管的解释例如:
require([ "dojo/on","dojo/dom-style", "dojo/ready", "dijit/registry", "dijit/layout/BorderContainer", "dijit/layout/ContentPane"],function(On, domStyle,ready,registry,BorderContainer,ContentPane){
\t ready(function(){
// apply resize after 3 seconde
window.setTimeout(resizeCenter,3000);
On(window,"resize",function(e){
console.log(e)
\t resizeCenter();
})
})
function resizeCenter(){
\t var centerPane = registry.byId("center").domNode;
parentWidth = domStyle.get(centerPane.parentNode,"width");
parentWidth -=28;
parentHeight = domStyle.get(centerPane.parentNode,"height");
parentHeight -=28;
///why removing 28 because 5*2 margin + 8*2 padding +2*1 borders = 28
//set top left right bottom if all regions are set
domStyle.set(centerPane,"top","5px");
domStyle.set(centerPane,"bottom","5px");
domStyle.set(centerPane,"left","5px");
domStyle.set(centerPane,"right","5px");
domStyle.set(centerPane,"z-index",10);
domStyle.set(centerPane,"width",parentWidth+"px");
domStyle.set(centerPane,"height",parentHeight+"px")
}
});
html, body {
width: 100%;
height: 100%;
margin: 0;
}
<link href="//ajax.googleapis.com/ajax/libs/dojo/1.10.0/dijit/themes/claro/claro.css" rel="stylesheet"/>
<script>
dojoConfig= {
parseOnLoad: true,
async: true
};
</script>
<script src="//ajax.googleapis.com/ajax/libs/dojo/1.10.0/dojo/dojo.js"></script>
<body class="claro">
<div data-dojo-type="dijit/layout/BorderContainer" style="width: 100%; height: 100%;">
<div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'top'">Top pane</div>
<div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'" id="center">center</div>
<div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'trailing'">Trailing pane</div>
</div>
</body>
你只有中心,或者您有其他的布局有了它,也就是边界容器100%的宽度和高度?你能解释更多 –
在链接中,如果你点击第一个例子,那么最上面的尾部是领先的和中心的。我给id =“中心”的中心地区。这是我想要扩展到全屏的那个。在我的示例版本中,中心大概是500像素或50%,并不是100%的宽度。如果我把它做成100%宽度,它似乎没有改变。 – techdog
也许[dojo/dom-style](https://dojotoolkit.org/reference-guide/1.10/dojo/dom-style.html#set)会有帮助吗? – barbsan