Dynamic Resize For Embedded IFrames
Updated 02-09-2024
I'd like to add a solution which I though was nicer. I added the package iframe-resizer to our project (https://www.npmjs.com/package/iframe-resizer)
Styled the iframe as so:
<iframe id="analytics-iframe" frameborder="0" class="dynamic-sizing" width="100%" url="your-dashboard-url"></frame>
iframe.dynamic-sizing {
width: 1px;
min-width: 100%;
min-height: 500px;
}
$("iframe.dynamic-sizing").each((el) => {
iFrameResizer({
log: true,
autoSize: false,
heightCalculationMethod: 'lowestElement'
}, el.id)
})