§ Adjust iframe height to contents
Some javascript in an iframe's content page can adjust the height of the iframe to its content.
Make sure the enclosing iframe has name="" and id="" exactly the same.
The window.name of a page in an iframe is the name of the iframe
function setParentIframeHeight() {
var ifrm;
if(ifrm=parent.document.getElementById(window.name)) {
ifrm.height=500; //or whatever. Some layouts won't shrink if a specific amount isn't set here.
ifrm.height=document.body.scrollHeight + 30;
}
}
function makeDoubleDelegate(function1, function2) {
return function() {
if (function1)
function1();
if (function2)
function2();
}
}
window.onload = makeDoubleDelegate(window.onload, setParentIframeHeight);
var ifrm;
if(ifrm=parent.document.getElementById(window.name)) {
ifrm.height=500; //or whatever. Some layouts won't shrink if a specific amount isn't set here.
ifrm.height=document.body.scrollHeight + 30;
}
}
function makeDoubleDelegate(function1, function2) {
return function() {
if (function1)
function1();
if (function2)
function2();
}
}
window.onload = makeDoubleDelegate(window.onload, setParentIframeHeight);
last edited on January 29th, 2009 at 11:52 AM
Categories
Comments
- Walid on "Adventures with Ubuntu 9.10 on G4 Yikes!" - I am in the same process as you. Although I still dual-boot to Windows for my ganimg leisure. My first contact with Ubuntu was way…
- Slashback on "Simpler adding & removing element classnames" - Actually, the addClassName function does what you want, pretty much the same way you suggest.
- angie on "Simpler adding & removing element classnames" - And what if I want to add a class, but keeping the csseals the element already has?I mean, I have an element with a class, let's name…
- backlinks on "Adjust iframe height to contents" - Definitely helped me.
- Slashback on "Simpler validate form fields are filled in (no additional class names)" - You are welcome!
backlinks says:
Definitely helped me.
November 23rd, 2011 at 1:26 AM