I probably asked this question before in a way =) But still, does anyone know if it's possible to have a fixed element inside an iFrame? I mean fixed i relation to the whole browser window?
Thank you!
I probably asked this question before in a way =) But still, does anyone know if it's possible to have a fixed element inside an iFrame? I mean fixed i relation to the whole browser window?
Thank you!
Share edited Mar 31, 2011 at 11:22 Erik Lydecker asked Mar 30, 2011 at 13:09 Erik LydeckerErik Lydecker 7173 gold badges12 silver badges29 bronze badges2 Answers
Reset to default 4No - you cannot display items within an iframe outside of its boundaries.
Solution for "Facebook app iframe" - you have your app in a an iFrame, when the user scrolls down, the whole page is scrolling down, both facebook and the iframe:
Using JavaScript normally you would position your fixed element like so:
top = window.height() / 2 - $(id).height() / 2
left = window.width() / 2 - $(id).width() / 2
From within iFrame do this:
top = window.parent.pageYOffset + window.parent.height() / 2 - $(id).height() / 2
left = window.width() / 2 - $(id).width() / 2