View Full Version : Make iframe grow with contents

11 Apr 2012, 6:04 AM
I'm initializing an Ext form in an iframe. This iframe is in a modal 'popup' layer in another application. Now, the form can grow vertically when inputting data. This eventually causes the submit button to be pushed outside the screen. What would be the best way to make this iframe grow along with the body? I tried attaching something to the body's 'onresize' event, but it's never fired.

11 Apr 2012, 6:33 AM
For now, I did it by removing the (inline) CSS width and height, and adding those as attributes (width=x height=x). Then I can change the iframe's size from within the iframe with:


So now I'm just doing this periodically;

run: function() { window.frameElement.height = Ext.getBody().getHeight(); },
interval: 1000