简体   繁体   English

如何将滚动条放置到jquery ui模态对话框内的jquery ui选项卡?

[英]How to place the scrollbar to a jquery ui tab within a jquery ui modal dialog?

I have created a simple modal dialog window. 我创建了一个简单的模态对话框窗口。 Inside the window, I have created two tabs. 在窗口内,我创建了两个选项卡。 Within tabs, I have put a dynamic tree. 在选项卡中,我放置了动态树。 The dynamic tree can grow in size when clicked on. 单击时,动态树的大小可能会增加。 When this happens, I get a scrollbar, on the side of the modal dialog window. 发生这种情况时,我在模式对话框窗口的一侧得到一个滚动条。

The problem is when I scroll down, the tab titles within my dialog disappear. 问题是当我向下滚动时,对话框中的选项卡标题会消失。 Is there a way to make sure the tab titles are stationary ? 有没有办法确保选项卡标题固定不动? In other words, rather than make the dialog bar scrollable, can the tabs have a scrollbar ? 换句话说,不是使对话框栏可滚动,而是选项卡是否具有滚动条?

I am quite green on css and javascript. 我对CSS和javascript相当满意。 The tabs are displayed within this modal dialog. 这些选项卡显示在此模式对话框中。 From that point on, dialog becomes scrollable when the tree is expanded instead of the tabs. 从那时起,展开树(而不是选项卡)时,对话框将变为可滚动。

<div id="dialog" title="File Browser">
    <div id="tabs">
       <ul>
         <li><a href="#finance">Finance FileShare</a></li>
         <li><a href="#hr">HR Fileshare</a></li>
       </ul>
     <div id="finance">
          <div id="financetree"></div>
     </div>
     <div id="hr">
            <div id="hrtree"></div>
     </div>
     </div>
     <div>Active node: <span id="echoActive">-</span></div>
</div>

The plugin will add a class .ui-tabs-panel to your panels, in your case the elements #finance and #hr . 该插件将在您的面板中添加一个.ui-tabs-panel类,在您的情况下为元素#finance#hr

The following CSS will fix the height of those panels and add a vertical scrollbar: 以下CSS将固定这些面板的高度并添加垂直滚动条:

.ui-tabs-panel {
    height: 300px;
    overflow-y: auto; // show vertical scroll if necessary
    overflow-x: hidden; // hide horizontal scroll
}

DEMO 演示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM