位置固定div在iframe不工作 [英] position fixed div in iframe not working

查看:245
本文介绍了位置固定div在iframe不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在facebook的iframe应用程序。我有一个弹出消息框在这个应用程序内。这弹出有固定的财产。但它不工作作为添加内部iframe没有滚动。

I am working on facebook iframe application . I have one pop up message box inside this application. That pop up is having fixed possition . But its not working as added inside iframe having no scroll.

如果在没有滚动的iframe中,是否可以将弹出窗口固定到位?

Is it possible to make pop up fixed in position if its in the iframe having no scroll?

推荐答案


如果在没有滚动的iframe中,可以将弹出窗口固定在位置上?

Is it possible to make pop up fixed in position if its in the iframe having no scroll?

Nope - iframe 本身就是一个文档。在 position:fixed 中的任何东西都不会相对于主文档固定

Nope - the iframe is a document in itself. Anything with position: fixed in there is not fixed relative to the main document.

如果你想要相对于主文档固定某些东西,你需要把它放到主文档中 - 直接,或者使用JavaScript复制节点(在这种情况下使用jQuery是一个好主意)。

If you want something to be fixed relative to the main document, you need to put it into the main document - either directly, or by copying the node using JavaScript (using jQuery is a good idea in such a case.)

为了后者工作,主文档和iframed文档需要在相同的协议,端口和域。

For the latter to work, both the main document and the iframed document need to be on the same protocol, port, and domain.

这篇关于位置固定div在iframe不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆