带有粘性标头的iframe

发布于 2025-01-28 07:25:01 字数 117 浏览 2 评论 0原文

我正在寻找将标头在iframe内部粘发的选项。如果我滚动,则标题应在内部粘稠,并且只有内容才能滚动。

我添加了位置:粘性和顶部:0对于标头元素,但这无效。

请让我知道是否可以解决此问题。谢谢。

I am looking for options to make the header inside an iframe to be sticky. If I scroll, the header should be sticky inside and only the content should scroll.

I have added position:sticky and top:0 for the header element, but that doesn't work.

Please let me know if any options to resolve this. Thanks.

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

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

发布评论

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

评论(1

背叛残局 2025-02-04 07:25:01

Dinesh,我正在寻找类似的解决方案。我们在内容管理系统中工作,因此我们无法控制如何渲染iframe。我相信我们遇到的问题是iframe具有滚动=“否”。如果是这种情况,我相信滚动时无法在屏幕的顶部或底部保持标头或页脚。它们将位于iFrame内容的顶部或底部。如果我的假设是正确的,那是iframe的视口是可见的浏览器窗口,而是iframe的大小。如果滚动未设置为否,则可能是可能的,但我不确定。

如果您找到解决方案,请分享以便其他人受益。我可能会看看我是否可以提出JavaScript解决方案,但可以选择不走这条路。

Dinesh, I'm looking for a similar solution. We are working in a content management system so we have no control over how the iFrame is rendered. I believe the issue we have is that the iFrame has scrolling="no". If that is the case, I believe there is no way to have a header or footer stay at the top or bottom of the screen when scrolling. They will be positioned at the top or bottom of the iFrame content. If my assumption is correct, it is that the viewport for the iFrame is not the visible browser window but the size of the iFrame. If scrolling is not set to no, it may be possible but I'm not certain.

If you find a resolution to this, please share so others may benefit. I may look to see if I can come up with a JavaScript solution but may choose not to go down that path.

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