Last active
September 7, 2016 10:10
-
-
Save LukeFF/c11586809409aa2d00f87d5145fc800c to your computer and use it in GitHub Desktop.
automatic Iframe resizing on same domain
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<iframe id="superFrame" src="..." style="width: 100%; border: none;" onload="resizeIframe(this)" scrolling="no"></iframe> | |
<script type="text/javascript"> | |
function resizeIframe(iframe) { | |
if(iframe) { | |
iframe.height = ''; | |
iframe.height = iframe.contentWindow.document.body.scrollHeight + 'px'; | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment