如果没有显示 JQuery UI 布局,则隐藏北面板

Hide North Panel if Nothing to Show with JQuery UI Layout

我有一个以北为中心的简单布局:

<html xmlns="http://www.w3.org/1999/xhtml">
    <body>
        <div id="north-main-div">
        </div>
        <div id="center-main-div">
        </div>
    </body>
</html>

和 JavaScript 这使得一个可隐藏的 Northpanel。

topMainLayout = $('body').layout({
    name : 'bodyLayout',
    north__paneSelector : '#north-main-div',
    center__paneSelector : '#center-main-div',
    north__resizable : false
});

如果 north-main-id 内没有任何内容(没有内容),我想实现整个北部区域包括切换器都不可见。目前,即使没有显示任何内容,切换器也会显示。

对于解决问题的任何提示,我将不胜感激。

谢谢

不确定这是否正确,但对我有用。

我只是检查它是否为空并调用隐藏函数。

topMainLayout = $('body').layout({
    name : 'bodyLayout',
    north__paneSelector : '#north-main-div',
    center__paneSelector : '#center-main-div',
    north__resizabele : false
}); 
if (!$.trim( $('#north-main-div').html() ).length) {
        topMainLayout.hide("north");
}