2016-02-10 18 views
1

我有一个简单的布局,北部和中部:隐藏北面板,如果没有要显示与jQuery UI布局

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

我想实现整个北方地区是看不到的,包括toggler如果没有(没有内容)是north-main-id内。目前,即使没有任何内容显示,切换器也会显示。

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

感谢

回答

0

不知道这是正确的方式,但它为我工作。

我正确地检查它是否为空并调用隐藏功能。

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