2010-01-27 116 views
0

我试图让iframe在用户点击iframe中的链接后自动调整大小。我怎样才能做到这一点?Iframe高度变化

+0

http://stackoverflow.com/questions/153152/resizing-an-iframe-based-on -内容 – Sampson 2010-01-27 16:44:19

回答

0

你需要使用一些Javascript才能做到这一点。如果你有兴趣做的iframe增长,以适应它里面装的页面,你可以做这样的事情:

parent.ResizeFrame({documentLoaded}.height()); 

的{} documentLoaded可你想借鉴你的身高任何元素。父页面上添加该功能

function ResizeFrame(height) { 
    getElementById("elementid").height(height); 
} 

使用jQuery工作的例子是这样的:

function ResizeFrame(height) { 
    $("#iframeid").height(height); 
} 

parent.ResizeFrame($("#fileForm").height());