自动调整iFrame高度 [英] Auto-Fit iFrame Height
问题描述
现在,我有一个jQuery UI弹出对话框,从外部页面读取。
Right now, I have a jQuery UI pop-up dialog that reads from an external page. This page reads from another external that has a video via flowplayer.
我使用iframe将视频嵌入到第一个视频中:
I'm using iframe to embed the video in the first:
<div id="donkeyVideo">
<iframe id="iframeDonkey" width="100%" height="496" src="../../../../video/donkey-2009-02-23.html" frameBorder="0"></iframe>
</div>
100%的宽度似乎没问题,但是100%有没有办法解决这个问题?
The width seems all right with 100%, but 100% height doesn't work. Is there a way around this?
在哪里和如何嵌入代码,以及ID的东西。
Where and how do I embed the code, as well as the ID stuff. Please anyone, help?
推荐答案
您必须使用某种JavaScript来动态调整iframe的高度,如果想要使用像100%而不是像素值。
You'll have to use some sort of JavaScript to dynamically adjust the height of an iframe if you want to use something like 100% rather than a pixel value.
不幸的是,我的理解是,你不能动态改变指向一个不同的域的iframe的高度
Unfortunately, my understanding is that you cannot dynamically alter the height of an iframe that is pointing to a different domain than your own.
从代码丢失:
请注意,这个jQuery autoHeight插件不能使用iFrames访问来自不同域或远程位置的内容,因为来自不同域的窗口对象由于JavaScript安全限制而无法从当前对象访问。
Please note that this jQuery autoHeight plugin will not work with iFrames accessing content from a different domain or remote location since the window object originating from a different domain cannot be accessed from the current one due to JavaScript security restrictions.
这篇关于自动调整iFrame高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!