Strontium_99
Strontium_99

Reputation: 1803

Resizing iframes

I know this question has been asked before in some form or another, and I also know iframes are evil, but in this particular instance I have no other option. I need to develop and iframe that pulls a small form widget from another domain. The width of the widget is fixed, but it contains panels the slide open and shut using jquery. Is there a way of getting the iframe to expand and contract according to what's happening with the iframes content? Thanks.

Upvotes: 0

Views: 119

Answers (2)

David Bradshaw
David Bradshaw

Reputation: 13077

Having had much the same issue and not finding an answer that solved all my use cases, I ended up writing a simple library to handle this.

https://github.com/davidjbradshaw/iframe-resizer

Upvotes: 1

stackErr
stackErr

Reputation: 4170

If you can edit the content of the page inside the iframe, you can use this jQuery plugin to communicate between the frame and the parent window:

http://benalman.com/projects/jquery-postmessage-plugin/

Upvotes: 1

Related Questions