dev-master
9999999-devYii2 extension for javascript-based iFrame Resizer
MIT
The Requires
- yiisoft/yii2 *
- bower-asset/iframe-resizer *
by Alexander Stepanov
plugin yii2 jquery widget iframe-resizer
Yii2 extension for javascript-based iFrame Resizer
Yii2 extension for javascript-based iframe-resizer. It enables automatic resizing of height and width of both same and cross domain iFrames to fit their contained content, provided that you have control of pages both serving and hosting iFrames., (*1)
Add extension to your composer.json
and update your dependencies as usual, e.g. by running composer update
, (*2)
{ "require": { "nirvana-msu/yii2-iframe-resizer": "1.0.*@dev" } }
You need to embed one of the library scripts into the iFrame. Extension provides two shortcuts for doing this, depending on your use-case., (*3)
IFrameResizer
widget in your view:IFrameResizer::widget();
</body>
tag:$injectedHtml = IFrameResizer::embed($html);
First, register IFrameResizerAsset
bundle:, (*4)
IFrameResizerAsset::register($this);
Finally, call the library to enable dynamic resizing. As described in the documentation, you can do this by either using native JavaScript:, (*5)
var iframes = iFrameResize( [{options}], [css selector] || [iframe] );
or via jQuery:, (*6)
$('iframe').iFrameResize( [{options}] );
Note that jQuery is not specified as a dependency for this extension, since you may choose to use native version instead. Therefore if you want to use jQuery, make sure it is registered in your view., (*7)
Extension is released under MIT license, same as underlying iFrame Resizer library., (*8)
Yii2 extension for javascript-based iFrame Resizer
MIT
plugin yii2 jquery widget iframe-resizer