iframeFitContent a jQuery Plugin

0

Aside from using the jQuery contents(); method to access iframe content, this plugin determines the actual height of the content, rather than using scrollHeight then adding X amount of extra height to the iframe itself.

Documentation:

To install the iframeFitContent plugin, download jquery-iframefitcontent.min.js and link to the script after installing jQuery 1.4.x. Then in a new script block call the .iframeFitContent(); method on a jQuerified object which contains a reference to iframes you’d like the plugin to resize.

To run the plugin on all iframes use the following code:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
<script src="http://www.yourserver.com/js/jquery.iframefitcontent.js" type="text/javascript"></script>
<script type="text/javascript">
	$('iframe').iframeFitContent();
</script>

To add padding to the bottom of your iframe add the padding parameter as follows. Note the padding value must be set as an number.
Or apply the re-size to either height or width:

    $('iframe').iframeFitContent({ resize : 'height' });

Current version: 1.0
Compressed filesize: 1.112 kb
License: MIT

Files:

Download
Demos
GitHub Repository

Dependencies

Support

  • Please post bug reports and other contributions ( enhancements, features ) to the gitHub issues tracker.

"iframeFitContent a jQuery Plugin" was published on November 16th, 2010 and is listed in My Work, Personal.

Follow comments via the RSS Feed | Leave a comment | Trackback URL