We have this group project and I was assigned to make a certain iframe
resizable. I've been reading lots of forum posts since last week, and I found out that iframe
itself can't be resizable.
Is there a way to make my iframe
resizable?
We have this group project and I was assigned to make a certain iframe
resizable. I've been reading lots of forum posts since last week, and I found out that iframe
itself can't be resizable.
Is there a way to make my iframe
resizable?
I found your solution:
HTML:
JQUERY:
This can be done in pure CSS, like so:
Set the height and width to the minimum size you want, it only seems to grow, not shrink.
Live example: https://jsfiddle.net/xpeLja5t/
This technique has good support in all major browsers except IE.
The best solution I've found is to set the width and height of the iframe to 100% and put the iframe within a div tag. This is the basic solution you see with tools like CKEditor.
For an example, I have some jQuery dialogs that do just that on the Utah's Disclosures Site. If you click on a report or statement of or, you'll see a dialog that pops up with an iframe in it. Hope it helps.
With jQuery UI...
HTML:
JavaScript:
jsFiddle: http://jsfiddle.net/B5vHQ/97/
Explanation:
Since jQuery UI's
resizable
plugin won't work on an iframe directly, wrap the iframe in a div and resize the div instead. Theresize
event in the code above ensures that the iframe resizes to match the div.There's an additional problem with this method, however - iframes don't pass mouse movement events to their parent element. To work around that, the
start
andstop
events cover the iframe up with another element during the resize, so that theresizable
plugin can track mouse movement correctly.For some reason, giving the wrapper div an explicit size is necessary for the resizing to work. In most cases, that means that the iframe needs the same size set, so thatit matches the size of the div right from the start.
In case you haven't found the solution yet, I've had success with:
Jquery:
HTML:
I hope it helps
Please follow the these step for Iframe resizeable:
Create a div for resizeable. eg:
Apply the style tag for style of div.
Include jQuery & jQuery UI
Execute
Resizable