jquery hide() 之后的 div 高度概率

发布于 2024-12-12 09:42:09 字数 132 浏览 1 评论 0原文

使用 jquery hide() 函数隐藏一些内部 div 后,外部 div 高度不适合,其高度与隐藏前一样长。

我的 IE 有这个问题,FF 没有 Chrome。

有什么办法解决!! (如果需要,我可以提供页面网址)

after hiding some inner divs with jquery hide() function, the outer div height doesn't fit and its height is as long as it was before hiding.

i've this problem with IE, FF not with Chrome.

what's the solution !!
( i can give the page url if requested )

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

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

发布评论

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

评论(1

挽手叙旧 2024-12-19 09:42:09

你是说外部 div 的高度改变了还是没有改变?请记住,当您执行 hide() 时,您将 css 设置为“display:none”。这意味着该元素不会占用 DOM 中的任何空间,如果它控制外部 div 的高度,那么您必须在隐藏外部 div 后手动设置其高度。

另一种选择是让外部 div 控制高度,然后隐藏()或显示()其内容。这样它将保持其尺寸。

希望这有帮助

Are you saying the outer div's height did or didn't change? Remeber when you do a hide() your setting the css to a "display:none". This means the element will not take up anyspace in the DOM and if it was controlling the height of the outer div, then you will have to manually set the outer div height after it is hidden.

Another option would to be is to let the outer div control the height and then just hide() or show() its contents. that way it will maintain its dimensions.

Hope this helps

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