Resizing an iframe based on content

后端 未结 21 2493
南方客
南方客 2020-11-21 07:40

I am working on an iGoogle-like application. Content from other applications (on other domains) is shown using iframes.

How do I resize the iframes to fit the heigh

21条回答
  •  梦如初夏
    2020-11-21 08:11

    The simplest way using jQuery:

    $("iframe")
    .attr({"scrolling": "no", "src":"http://www.someotherlink.com/"})
    .load(function() {
        $(this).css("height", $(this).contents().height() + "px");
    });
    

提交回复
热议问题