All Collections
Working with Embeds
Have your embed element auto-resize
Have your embed element auto-resize
Alex Piepenbrink avatar
Written by Alex Piepenbrink
Updated over a week ago

If you want your embed element to grow and shrink along with the content inside of it, you'll need to add code in two places.

On the page or content that will be embedded into TIME Sites, add this code:

<script src="https://cdn.jsdelivr.net/npm/iframe-resizer@4.2.11/js/iframeResizer.contentWindow.min.js"></script>


In TIME Sites, you'll add this code in an un-iframed embed element:

<style>.bc-embed-wrapper .bc-embed.embed-no-iframe, .bc-embed-wrapper .bc-embed.embed-no-iframe iframe {position: relative;}</style> <script src="https://cdn.jsdelivr.net/npm/iframe-resizer@4.2.11/js/iframeResizer.min.js"></script><script>document.addEventListener('DOMContentLoaded', function() { iFrameResize({ checkOrigin: false, inPageLinks: true }, 'iframe'); });</script> 

And then place the iframe code underneath that code within the same embed element. If you're iframing a form or some other widget, the platform you created that on will provide an iframe code. If you just want to embed an existing website, you can iframe it using the following code:

<iframe src="https://url.com"></iframe>

Where you replace url.com with the url you want to embed.

Did this answer your question?