Return to Snippet

Revision: 62449
at February 23, 2013 09:56 by Neven


Initial Code
$("#modalIFrame").bind('load',
            function () {
                var newheight, 
                newwidth;

                newheight = this.contentWindow.document.body.scrollHeight;
                newwidth = this.contentWindow.document.body.scrollWidth;

                $(this).height(newheight);
                $(this).width(newwidth);
            }
        );

        $("#modalIFrame").attr('src', url);

Initial URL


Initial Description
Bind onload function to the iFrame and set the size of the iFrame to the iFrames loaded content.
In the example jQuery is used.

Initial Title
Resize iFrame to its content

Initial Tags
resize

Initial Language
JavaScript