隐藏北面板(如果未要使用 JQuery UI 布局显示任何内容)

Hide North Panel if Nothing to Show with JQuery UI Layout

本文关键字:布局 UI JQuery 显示 任何内 如果 隐藏      更新时间:2023-09-26

我有一个简单的布局,有北和中心:

<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");
}