使占位符 div 可动态重叠

发布于 2024-10-07 10:52:27 字数 275 浏览 0 评论 0原文

我使用 jQuery UI 手风琴作为页面右侧的菜单。但是,有时菜单会比左侧的内容高。因此,当展开/收缩手风琴部分时,浏览器上的滚动条会在打开手风琴部分时增大/缩小。我的想法是在手风琴下方有一个 div,这是手风琴可能达到的高度,当手风琴展开时,它只会与它重叠,因此根本不会改变浏览器上的滚动条(希望这是有道理的)。给它一个位置:绝对并声明高度和宽度似乎会搞乱布局,将其放置在页脚上方但在其下方流血。有人对如何实现这项工作有任何想法吗?如果您需要更详细的示例,我会看看我能做些什么来提供它,但是,该网站已被锁定,我无法给出用户名/密码。

I'm using a jQuery UI accordion as a menu on the right side of a page. However, there are occasions where the menu will be taller than the content on the left. Because of this, when expanding/contracting sections of the accordion, the scrollbar on the browser can grow/shrink when opening a section of the accordion. My thought was to have a div below the accordion which is the height that the accordion could possibly get to, and when the accordion expands it would just overlap it, thus not changing the scrollbar on the browser at all (hope that makes sense). Giving it a position: absolute and declaring the height and width seems to screw up the layout, placing it overlapping the footer but bleeding below it. Anyone have any ideas on how to make this work? If you need a more detailed example, I'll see what I can do to provide it, however, the site is locked down and I can't give out a username/password.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

绅士风度i 2024-10-14 10:52:27

Min-height 在 IE 6 中很容易实现。
来自达斯汀·迪亚兹 (Dustin Diaz) 的最古老的黑客:

selector {
    min-height:500px;
    height:auto!important;
    height:500px;
}

或者用表达式:

selector {
    height:expression( this.scrollHeight < 499 ? "500px" : "auto" ); 
}

事实上,对于 IE 6 高度就像 min-height。元素将随着其中的内容展开,直到指定了 overflow:hidden

您始终只能使用“* html hack”或条件注释来应用 IE 6 的规则。

Min-height is easy to implement in IE 6.
The oldest hack from Dustin Diaz:

selector {
    min-height:500px;
    height:auto!important;
    height:500px;
}

Or with expressions:

selector {
    height:expression( this.scrollHeight < 499 ? "500px" : "auto" ); 
}

In fact for IE 6 height is like min-height. Element will expand with the content in it, until there is overflow:hidden specified..

You can always apply rules for IE 6 only with "* html hack" or with Conditional Comments.

書生途 2024-10-14 10:52:27

您可能在菜单和内容周围有一个容器,对吧?您可以向容器添加一个 css min-height ,该高度等于菜单的最高高度

You probably have a container around the menu and the content right? You could add a css min-height to the container which would be equal to the tallest that the menu could be in height

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文