jquery - 如何构建具有多个嵌套布局的 easyui 布局?

标签 jquery html css jquery-easyui

我在我的应用中使用了 easyui 嵌套布局。我引用了 easyui 演示中给出的以下代码。

<div class="easyui-layout" style="width:700px;height:350px;">
        <div data-options="region:'north'" style="height:50px"></div>
        <div data-options="region:'south',split:true" style="height:50px;"></div>
        <div data-options="region:'east',split:true" title="East" style="width:180px;"></div>
        <div data-options="region:'west',split:true" title="West" style="width:100px;"></div>
        <div data-options="region:'center',iconCls:'icon-ok'" title="Center">
            <div class="easyui-layout" data-options="fit:true">
                <div data-options="region:'north',split:true,border:false" style="height:50px"></div>
                <div data-options="region:'west',split:true,border:false" style="width:100px"></div>
                <div data-options="region:'center',border:false"></div>
            </div>
        </div>
 </div>

演示链接是

http://www.jeasyui.com/demo/main/index.php?plugin=Layout&theme=default&dir=ltr&pitem=

我需要像这样使用多个内部布局。

<div class="easyui-layout" style="width:700px;height:350px;">
         <div data-options="region:'north'" style="height:50px"></div>
         <div data-options="region:'south',split:true" style="height:50px;"></div>
         <div data-options="region:'east',split:true" title="East" style="width:180px;"></div>
         <div data-options="region:'west',split:true" title="West" style="width:100px;"></div>
         <div data-options="region:'center',iconCls:'icon-ok'" title="Center">
             <div class="easyui-layout" data-options="fit:true" id="innerlayout1">
                 <div data-options="region:'north',split:true,border:false" style="height:50px"></div>
                 <div data-options="region:'west',split:true,border:false" style="width:100px"></div>
                 <div data-options="region:'center',border:false"></div>
             </div>
             <div class="easyui-layout" data-options="fit:true" id="innerlayout2" style="display:none;">
                          <div data-options="region:'north',split:true,border:false" style="height:50px"></div>
                          <div data-options="region:'west',split:true,border:false" style="width:100px"></div>
                          <div data-options="region:'center',border:false"></div>
             </div>
             <div class="easyui-layout" data-options="fit:true" id="innerlayout3" style="display:none;">
                          <div data-options="region:'north',split:true,border:false" style="height:50px"></div>
                          <div data-options="region:'west',split:true,border:false" style="width:100px"></div>
                          <div data-options="region:'center',border:false"></div>
             </div>
         </div>
 </div>

默认情况下第一个内部布局是可见的,对于这个东部地区必须处于展开状态。当另一个 innerlayout 可见时,其他 innerlayout 被隐藏并且 east 区域被折叠。我的问题是,当东部地区折叠时,中心和东部地区之间会出现空白。我想让中心区域变大,这样空间就不会来了。

抱歉我的英语不好。请帮我解决这个问题。

最佳答案

如果我明白你想做什么,你需要先把中心分成西、中、东,然后再把每一个分成北、西和中:

<div class="easyui-layout" data-options="fit:true";">
        <div data-options="region:'north',split:true" style="height:50px"></div>
        <div data-options="region:'south',split:true" style="height:50px;"></div>
        <div data-options="region:'east',split:true" title="East" style="width:100px;"></div>
        <div data-options="region:'west',split:true" title="West" style="width:100px;"></div>
        <div data-options="region:'center', split:true">
            <div class="easyui-layout" data-options="fit:true">
                <div data-options="region:'east',split:true" style="width:250px">
                     <div class="easyui-layout" data-options="fit:true">
                        <div data-options="region:'north',split:true" Title="Center East" style="height:150px"></div>
                        <div data-options="region:'west',split:true"  style="width:125px;"></div>
                        <div data-options="region:'center',split:true"></div>
                    </div>
                </div>
                <div data-options="region:'west',split:true" style="width:250px">
                    <div class="easyui-layout" data-options="fit:true">
                        <div data-options="region:'north',split:true" Title="Center West" style="height:150px"></div>
                        <div data-options="region:'west',split:true"  style="width:125px;"></div>
                        <div data-options="region:'center',split:true"></div>
                    </div>
                </div>
                <div data-options="region:'center',split:true" >
                   <div class="easyui-layout" data-options="fit:true">
                        <div data-options="region:'north',split:true" Title="Center Center" style="height:150px"></div>
                        <div data-options="region:'west',split:true"  style="width:125px;"></div>
                        <div data-options="region:'center',split:true"></div>
                    </div>
                </div>
            </div>
        </div>
     </div>

结果: enter image description here

关于jquery - 如何构建具有多个嵌套布局的 easyui 布局?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23759445/

相关文章:

html - 如何避免 &lt;input&gt; 和 <span> 元素之间出现小空间?

html - X-Frame-Options 在元标记中不起作用?

jquery - 使用 jQuery 更改样式表 href 不太有效

jquery - 如果默认关闭,jQuery ui 选项卡中的内容是否会被编入索引?

jquery - 如果 url 不以 "/"结尾,则使用 jQuery 将 "/"附加到该 url

javascript - 使用 PHP Simple HTML DOM Parser 抓取脚本生成的文本

javascript - 选择当前元素 jquery - 多个div

css - 为什么嵌入的谷歌地图会改变 Safari 的字体渲染?

javascript - 每次加载 Controller 时生成相同的随机数

jquery - 如何对内容 block 进行动画处理?