🤔 Situation
Your page is embedded to an iframe which ID is parent-iframe
, and you want to change the height by your page content.
<html>
<head>
</head>
<body>
<div>
<iframe src="https://your.html" id="parent-iframe"></iframe>
</div>
</body>
</html>
🦄 Solution
Run a script from inside to the iframe, when the page is ready.
<head>
<script type="text/javascript">
$(document).ready(function() {
$("#parent-iframe", window.parent.document).height(document.body.scrollHeight);
});
</script>
</head>
Top comments (0)