From randallwiggins
Jump to: navigation, search
 
Line 1: Line 1:
<html><iframe width="100%" height="2048" src="/plugins/abctunebook/index.html"></iframe></html>
+
<html>
 +
<script type="application/javascript">
 +
 
 +
function resizeIFrameToFitContent( iFrame ) {
 +
 
 +
    iFrame.width  = iFrame.contentWindow.document.body.scrollWidth;
 +
    iFrame.height = iFrame.contentWindow.document.body.scrollHeight;
 +
}
 +
 
 +
window.addEventListener('DOMContentLoaded', function(e) {
 +
 
 +
    var iFrame = document.getElementById( 'iFrame1' );
 +
    resizeIFrameToFitContent( iFrame );
 +
 
 +
    // or, to resize all iframes:
 +
    var iframes = document.querySelectorAll("iframe");
 +
    for( var i = 0; i < iframes.length; i++) {
 +
        resizeIFrameToFitContent( iframes[i] );
 +
    }
 +
} );
 +
 
 +
</script>
 +
 
 +
<iframe width="100%" id="iFrame1" src="/plugins/abctunebook/index.html"></iframe></html>

Latest revision as of 06:05, 28 January 2019