Created
March 19, 2013 20:45
-
-
Save kevinthompson/5199970 to your computer and use it in GitHub Desktop.
Resize iFrame Example
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
document.write('<iframe src="iframe.html" id="unique-id" onload="resizeIframe();" />') | |
function resizeIframe() { | |
document.getElementById('unique-id').style.height = document.getElementById('unique-id').contentWindow.document.body.offsetHeight + 'px'; | |
} |
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
<!doctype html> | |
<html> | |
<head> | |
</head> | |
<body> | |
<div style="height:400px;"> | |
<h2>iFramed Content</h2> | |
</div> | |
</body> | |
</html> |
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
<!doctype html> | |
<html> | |
<head> | |
</head> | |
<body> | |
<h1>This is iframed content:</h1> | |
<script src="embed.js"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment