Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

Commit

Permalink
Add extra height to the iframe (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonydillon authored Mar 8, 2017
1 parent 8522257 commit fdfe028
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
4 changes: 3 additions & 1 deletion js/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ function renderIframe(placementElement, html) {
var resizeInterval = setInterval(
function() {
if (iframe.contentDocument.readyState == 'complete') {
iframe.height = iframe.contentDocument.body.scrollHeight + "px";
// Add extra spacing to catch edge cases
const frameHeight = iframe.contentDocument.body.scrollHeight + 10;
iframe.height = frameHeight + "px";
clearInterval(resizeInterval);
}
},
Expand Down
13 changes: 9 additions & 4 deletions pattern/card.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@
</style>
</head>
<body>
<div class="card">
<h2>title</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute.</p>
</div>
<div class="card">
<h2>title</h2>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat. Duis aute.
</p>
</div>
</body>
</html>

0 comments on commit fdfe028

Please sign in to comment.