Created
September 23, 2013 23:30
-
-
Save MarkRoddy/6678417 to your computer and use it in GitHub Desktop.
Only via Firefox: Javascript running inside an iframe that is hidden does not report the appropriate size of elements. If you remove style="display: none" from the iframe the correct size is reported.
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
<html> | |
<script src="http://code.jquery.com/jquery-1.8.2.js"></script> | |
<body> | |
Inner HTML | |
<div class="some-container">Inside Container</div> | |
<script> | |
alert("Container width: " + $(".some-container").width()); | |
alert("Container outer width: " + $(".some-container").outerWidth()); | |
</script> | |
</body> | |
</html> | |
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
<html> | |
<script src="http://code.jquery.com/jquery-1.8.2.js"></script> | |
<body> | |
Outer HTML | |
<iframe id="daframe" style="display: none" src="inner.html"></iframe> | |
<script type="text/javascript"> | |
$("#daframe").on("load", function (e) { | |
$("#daframe").css("display", "block"); | |
}); | |
</script> | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment