Quantcast
Viewing all articles
Browse latest Browse all 28

Answer by Mario Gonzales Flores for Resizing an iframe based on content

Work with jquery on load (cross browser):

<iframe src="your_url" marginwidth="0"  marginheight="0" scrolling="No" frameborder="0"  hspace="0" vspace="0" id="containiframe" onload="loaderIframe();" height="100%"  width="100%"></iframe>function loaderIframe(){var heightIframe = $('#containiframe').contents().find('body').height();$('#frame').css("height", heightFrame); }  

on resize in responsive page:

$(window).resize(function(){if($('#containiframe').length !== 0) {var heightIframe = $('#containiframe').contents().find('body').height(); $('#frame').css("height", heightFrame);}});

Viewing all articles
Browse latest Browse all 28

Trending Articles