绝对位置元素未隐藏在滚动框之外

发布于 2024-12-27 21:33:39 字数 365 浏览 0 评论 0原文

我有一些场景,我需要一个滚动条,并且我需要一个用于多种目的的弹出框,在示例中它只是用于照片元素上的名称。无论如何我可以做到这一点吗?

照片示例: http://img36.imageshack.us/img36/4696/problemtn.png

这就是它应该如何工作,但是我也需要自动溢出..(所以取消注释,然后你就会看到我的问题):

http://jsfiddle.net/kGAPG/

I have some scenarios where I need to have a scrollbar, and I need to have a box popup for multiple purposes, in the example It's just for a name over a photo element. Is there anyway I can do this?

Photo example:
http://img36.imageshack.us/img36/4696/problemtn.png

As is is how it should work, however I need to have overflow auto as well.. (so uncomment it, then you see my problem):

http://jsfiddle.net/kGAPG/

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

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

发布评论

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

评论(2

淡淡の花香 2025-01-03 21:33:39

将弹出 div 设置为绝对位置,并将其父级设置为相对位置
设置 z 索引:1000;到 popup 的父容器的父容器并设置 z-ndex:1001;到弹出窗口的父级并设置 z-index:1002;弹出。下次请将您的代码放在板上或 http://jsfiddle.net/

set your popup div at absolute postion and and its parent at relative postion
set z-index:1000; to the parent container of the parent of popup and set z-ndex:1001; to parent of popup and the set z-index:1002; to popup. and please next time put your code on the board or at http://jsfiddle.net/

淡笑忘祈一世凡恋 2025-01-03 21:33:39

这取决于您如何布置元素。如果您尝试在浏览器的滚动条上弹出工具提示窗口,那么不,您不能这样做(据我所知)。

如果您有一个带滚动条的 div,并且该 div 包含在屏幕中间,那么您可以这样做。

您需要做的是在文档的顶层创建一个 div 并将其位置设置为“绝对”。然后,使用 jquery 获取您希望在旁边弹出框的图片元素的位置,并相应地设置顶级 div 的 topleft 样式属性(记住添加一些偏移量)

让我知道这是否是您想要做的!

this depends on how you have your elements layed out. If you are trying to have the tooltips window pop up over the browser's scrollbars, then no, you can't do that (afaik).

If you have a div with scrollbars and that div is contained in the middle of the screen, yes you can do that.

What you will need to do is create a div at the top level of the document and have its position set to "absolute". Then, with jquery, get the position of the picture element you want the box to pop up next to and set the top-level div's top and left style attributes accordingly (remembering to add some for the offset)

Let me know if that is what you are trying to do!

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