Skip to content

Instantly share code, notes, and snippets.

@sudikrt
Created August 9, 2019 02:59
Show Gist options
  • Select an option

  • Save sudikrt/05c1bf8d2bf26a9315bb2c4b18cda23e to your computer and use it in GitHub Desktop.

Select an option

Save sudikrt/05c1bf8d2bf26a9315bb2c4b18cda23e to your computer and use it in GitHub Desktop.
jQuery(function($){
var lastHeight = 0, curHeight = 0, $frame = $('iframe:eq(0)');
setInterval(function(){
curHeight = $frame.contents().find('body').height();
if ( curHeight != lastHeight ) {
$frame.css('height', (lastHeight = curHeight) + 'px' );
}
},500);
});
https://stackoverflow.com/questions/14334154/iframe-auto-adjust-height-as-content-changes?rq=1
https://www.tutorialrepublic.com/faq/automatically-adjust-iframe-height-according-to-its-contents-using-javascript.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment