开发者

Iframe changing height

I开发者_如何学编程 am trying to get an iframe to automatically resize once a user clicks a link inside of the iframe. How can I do this?


You'll need to use some Javascript to do this. If you are interested in making the iframe grow to accommodate the page loaded inside it you can do something like this:

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

the {documentLoaded} can be whatever element you want to draw your height from. on the parent page you add the function

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

a working example with jquery is such:

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

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜