I'm trying to put two responsive iframes
on top of each other on one page.
Unfortunately the content of the iframe
is resizing right but height of the iframe boarder doesn't change so there is an increasing cap between the two iframes when you re-size the window. I hope you can see what I mean. What can I do to avoid that gap?
function adjustIframes() {
$('iframe').each(function() {
var
$this = $(this),
proportion = $this.data('proportion'),
w = $this.attr('width'),
actual_w = $this.width();
if (!proportion) {
proportion = $this.attr('height') / w;
$this.data('proportion', proportion);
}
if (actual_w != w) {
$this.css('height', Math.round(actual_w * proportion) + 'px');
}
});
}
$(window).on('resize load', adjustIframes);
iframe {
margin: 5px;
}
<center>T E S T T O P</center>
<iframe frameborder="0" height="600" src="http://danielsalaw.de/Bilder/Melli/indexRev.html" width="100%"></iframe>
<iframe frameborder="0" height="600" src="http://danielsalaw.de/Bilder/Kocha/indexRev.html" width="100%"></iframe>
<center>T E S T B O T T O M</center>