Jump to content

[solved] Ajax loaded content wrong size in iFrame


Tim

Recommended Posts

Hi,

 

I had an issue with loading my own custom content from ajax into a widget where sometimes the iframe didn't resize to fit the new content, resulting in the content being cut off. To solve this after loading in the new content you can simple call the resize event to the 'window' (thanks Alejandro).

 

just call this after loading your content

 

window.parent.dispatchEvent(new Event('resize'));

 

The 'parent' is to ensure it's the iframe level. I've not tested it in all browsers yet.

 

Hope this helps someone  :)

 

Tim

Link to comment
×
×
  • Create New...