position fixed div in iframe not working

ぐ巨炮叔叔 提交于 2019-12-22 04:35:19

问题


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.

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


回答1:


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

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

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.)

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



来源:https://stackoverflow.com/questions/7609062/position-fixed-div-in-iframe-not-working

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!