Quantcast
Channel: Resizing an iframe based on content - Stack Overflow
Viewing all articles
Browse latest Browse all 28

Answer by ddlab for Resizing an iframe based on content

$
0
0

may be a bit late, as all the other answers are older :-) but... here´s my solution. Tested in actual FF, Chrome and Safari 5.0.

css:

iframe {border:0; overflow:hidden;}

javascript:

$(document).ready(function(){    $("iframe").load( function () {        var c = (this.contentWindow || this.contentDocument);        if (c.document) d = c.document;        var ih = $(d).outerHeight();        var iw = $(d).outerWidth();        $(this).css({            height: ih,            width: iw        });    });});

Hope this will help anybody.


Viewing all articles
Browse latest Browse all 28

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>