davidjbradshaw / iframe-resizer

Keep iFrames sized to their content.
https://iframe-resizer.com
Other
6.62k stars 977 forks source link

How to handle media queries? #1244

Closed socketopp closed 1 month ago

socketopp commented 2 months ago

I got an iframe with media-queries, it needs the width of the iframe to be 100% otherwise the media queries won't work, but at the same time, I don't want the iframe to be bigger than necessary. I am very curious how to solve this since it feels like an obvious error many people should have encountered.

I don't want the width of the iframe to be larger than the widget itself but at the same time, if I would set it to fixed 400px (roughly the size of the widget, the media queries doesn't respond when the parent viewport is changing)

image

davidjbradshaw commented 2 months ago

Just set the width to 100% and maxWidth to 400px