iframeautoheight set the height of an iframe to its contents height ,wrap the jQuery plugin(https://github.com/house9/jquery-iframe-auto-height)

  1. Requirements
  2. Usage
  3. Resources

this is a wrapper for the jquery-iframe-auto-height(jquery-iframe-auto-height on github) plugin

which can set the height of an iframe to its contents height .

note: now it can't handle the cross domain url .

Requirements

test it on yii 1.1.10 , should work with other versions ..

Usage

extract it to protected/extensions dir . (actually any dir if you want ) and then in your view file or layout file which contain the iframe you want to manipulate

<?php
        $this->widget('ext.iframeAutoHeight.IFrameAutoHeight', array(
                //'debug' => false ,
                'selector'=>'iframe' ,// the css selector which select the target iframe  you want apply this plugin to
                'callback'=>'js: function(callbackObject) {
                                           var m = "new size is " + callbackObject.newFrameHeight;
                                           window.console && console.log(m) || alert(m);
                                           // you can use "this" to refer the target iframe obj
                                       }'
            )
        );
        ?>
        <iframe src="http://localhost/my/yiiSpace/" name="contentFrame" id="contentFrame" width="100%" height="800px"/>


you can use javascript to set the iframe src to see what's happening

$("#contentFrame").attr("src","anotherUrl");

Resources

...external resources for this extension...

1 0
5 followers
742 downloads
Yii Version: 1.1
License: MIT
Category: User Interface
Developed by: yiqing95
Created on: Sep 25, 2012
Last updated: 12 years ago

Downloads

show all

Related Extensions