Created
August 8, 2015 15:41
-
-
Save 01-Scripts/50dc5ba2131d6da6f394 to your computer and use it in GitHub Desktop.
Iframe-Höhe automatisch an Inhalt anpassen
This file contains 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
<script type="text/javascript"> | |
var giframe; | |
var gURL; | |
function periodicResize(iframe){ | |
giframe = iframe; | |
setInterval(resizeIframe, 500); | |
} | |
function resizeIframe() { | |
if(giframe.contentWindow.document.body != null && giframe.contentWindow.document.body.scrollHeight > 0){ | |
if(giframe.contentWindow.document.URL != gURL) | |
giframe.height = "780px"; | |
else | |
giframe.height = giframe.contentWindow.document.body.scrollHeight + "px"; | |
gURL = giframe.contentWindow.document.URL; | |
} | |
} | |
</script> | |
<iframe width="100%" height="780" onload="periodicResize(this)" frameborder="0" scrolling="auto" marginheight="0" marginwidth="0" name="roomres" id="roomIFrame"></iframe> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment