Skip to content

Commit

Permalink
fix: calculate iframe height correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
gion-andri committed Dec 1, 2023
1 parent 9c54897 commit 48f70f3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,13 @@ export class AppComponent implements OnInit {
}

private resizeParentIframe() {
const height = document.documentElement.scrollHeight;
const body = document.body;
const html = document.documentElement;
const height = Math.max(body.scrollHeight, body.offsetHeight, html.offsetHeight);
const message = {
type: 'resizeIframe',
value: height
};
console.log(message)
window.parent.postMessage(message, "*");
}
}
15 changes: 11 additions & 4 deletions src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,20 @@ body {
letter-spacing: 0.2px;
-webkit-font-smoothing: auto;
-moz-osx-font-smoothing: grayscale;
}

#container {
background-color: white;
min-height: 100vh;
#container {
background-color: white;
min-height: 100vh;
}

&.iframe {
#container {
min-height: unset;
}
}
}


.container {
max-width: 1280px;
margin: 0 auto;
Expand Down

0 comments on commit 48f70f3

Please sign in to comment.