的问题主要是你的标记。 “隐藏导航按钮”包含在#leftNavigator中,因此当您隐藏#leftNavigator时,您还隐藏了您希望保持可见的按钮。有很多方法可以修改你的标记来完成这项工作。
本质上,我只是为导航器创建了一个包装并将其定位,并且在其中定位了“我隐藏导航按钮”。我还向两个控制面板按钮添加了顶部边距,以便为“我隐藏导航”按钮留出空间。有很多方法来完成这项工作。
#leftNavigator{float:left; width:100%; background-color:red;}
#top{height:150px; background-color:blue;}
#controlPanel{height:50px; background-color:gray;}
#tree{background-color:green;}
#content{overflow:auto; background-color:coffee;}
#btn{z-index:10;position:absolute;top:150px;}
#navigator_wrapper{position:relative;height:150px;width:20%}
#controlPanel button {margin-top:25px;}
<div id="navigator_wrapper">
<button id="btn">I hide the nav</button>
<div id="leftNavigator">
<div id="top">I have an image</div>
<div id="controlPanel"><button>Other</button><button>controls</button></div>
<div id="tree">I'm a jstree</div>
</div>
</diV>
<div id="content">
I take all the space I want. Except for leftNavigator's space.
</div>
这里是一个jfiddle http://jsfiddle.net/samisadaka/9c7va/
这里是一个粗略的编辑:):http://jsfiddle.net/Ktqbz/1/。这只是众多解决方案之一。 – Joe 2012-08-02 14:34:55