I have a div that is placed inside iFrame. Now this iFrame is position right on the screeen.
Now I am in need to position a div that is inside this frame relative to window not to its container.
html
<FRAMESET rows="136,*" frameborder="no" framespacing="0">
<FRAME id="cmTop" scrolling="no" src="ABC.aspx?empNo=<%=strEncrEmpNo%>" noresize>
</FRAMESET>
ABC.aspx
<div id="popUp">
This is popUp div that I need to place right on the middle of the screen
</div>
I tried with the position: fixed, static,absolute but somehow the div is not coming out of the frame.
div#popUp
{
positon:fixed;
top:25px;
left : 20%;
z-index : 999999999;
}
Please excuse for this structure as this is damn legacy system & no control to remove these frames.
Any help/suggestions highly appreciated. Thanks
答案 0 :(得分:0)
我认为没有干净的方法可以做你想做的事, 我可以给出一些提示但不是解决方案,希望有人会给你一个工作。 您可以尝试将弹出窗口附加到IFRAME的父级 window.parent.appendChild()或window.parent.querySelector(&#39;#myDivPopup&#39;)。innerHTML = myPopupInsideIframe 但这是一种很糟糕的方式。
在IFRAME和PARENT之间进行通信的最佳方式是window.postmessage(...)。