Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

position fixed div in iframe not working

Tags:

html

css

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.

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

like image 579
Arpit Vaishnav Avatar asked Feb 03 '23 13:02

Arpit Vaishnav


1 Answers

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.

like image 106
Pekka Avatar answered Feb 05 '23 14:02

Pekka