Dynamically adjust iframe height based on content

There are many answers on how to dynamically change the height of an iframe. I tried the plugin https://github.com/house9/jquery-iframe-auto-height

The plugin works with iframe load, however, the height does not dynamically change based on changes in the iframe content if the content is not reloaded (for example, ajax).

My question is: how to dynamically change the height of the iframe as the content changes height?

+3
source share
1 answer

Edit ... Well, my friend told me correctly. I removed the plugin from the main window and added this jquery code to the iframe page:

_

setInterval(function(){
    //console.log($("body").height());
    parent.$("iframe").height($("body").height());
}, 100);

, . , , ... Chrome...

Chrome, Chrome, iframe . IE9 FF12 .

+1

All Articles