View Full Version : Autosize Iframe
thescente
06-30-2006, 02:35 AM
Hi!
I created simple script that redimensiona my iframe, in the IE functions, but in the Mozilla Firefox not.
Script:
function resizeIframe() {
alt = document.getElementById("conteudo");
frm = parent.document.getElementById("ibracont");
frm.height = alt.offsetHeight;
alert("Iframe id=bracont: "+frm.height+" Table id=conteudo: "+alt.offsetHeight);
}
Click here to show a example. (http://www.bradigital.com.br/bra/ferramenta/painel/index.php)
1, Click in "Fale Conosco"
2, Click in "Enviar"
3, Click in "Voltar"
It noticed that the main page did not bring up to date the iframe? Why in Firefox it does not function?
jscheuer1
06-30-2006, 03:17 AM
It is working. Since you have no border on the iframe, there is no way visually to determine its size. The problem is that the table on the top page:
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
having its height set to 100%, remains large, even when the iframe later shrinks. To see this, add this to your stylesheet:
#bra_cont {
border:1px solid black;
}
Then try it out, you will see that the iframe resizes just fine.
minmax
08-10-2006, 02:18 AM
Hi
Your script seem do what I need. Is it possible to get a copy ? and if possible how I have to install it.
Regards
jscheuer1
08-10-2006, 06:08 AM
DD has this script:
http://www.dynamicdrive.com/dynamicindex17/iframessi2.htm
As for the code used by thescente, you would have to try contacting him/her to see. For purely experimental purposes, you could view the source of the demo thescente posted a link to and get the code that way.
minmax
08-11-2006, 11:41 AM
HI
I already tried this script but if I want as it works, I have to refresh the page each time see example http://brosseau.qc.ca/nouveau/header.html
link l'entreprise / Notre équipe and link liquidation
jscheuer1
08-11-2006, 12:01 PM
You can't put the iframe inside a table with its width set to 100%. Better still is not to put it inside any table. Try the script out on an otherwise empty page, to at least get the hang of it.
Murphyprecht
04-01-2009, 09:29 AM
Hi guys, this works fine in IE but can't get it to function in Opera. Any ideas?
molendijk
04-01-2009, 11:05 AM
Hi Murphyprecht,
It functions in Opera here (http://home.comcast.net/~jscheuer1/side/iframe_ssi_iv/).
===
Arie.
Murphyprecht
04-01-2009, 11:21 AM
Yeah, Iframe works but not the autosizing.
Working fine in IE and Firefox, I'm completely lost.
Murphyprecht
04-01-2009, 11:28 AM
Excuse the second quote I misread your source. Your code looks different initially to what I have so I clearly have done something wrong.
It works fine for all pages except Forum unless I switch to IE or FF any ideas mate?
CQBScotland (http://www.cqbscotland.co.uk/home.shtml)
molendijk
04-01-2009, 11:42 AM
Do you have a link to your problematic page(s)?
===
Arie.
Murphyprecht
04-01-2009, 12:20 PM
Yeah mate, go to the main page and click forum. Whole thing loads beautifully in everything except Opera (excuse the poor banner it's just to fill some space for now :) )
Click Here (http://www.cqbscotland.co.uk/home.shtml)
molendijk
04-01-2009, 12:43 PM
I see. I suggest you contact the author of the script (jscheuer1).
===
Arie.
The Dynamic Drive script looked good for me and I installed it and it pulled up my page no problem, full height no scrollbars :)
But.....I was actualyy pulling in a wordpress page, and as soon as I clicked the 'login' link on my wordpress page, the iframe jumped back to a smaller size with scrollbars. don't get me wrong, it displayed the wordpress admin ok and everything was functional..except the frame height.
But when I logged out and returned to my main wordpress page (within the page!) all was well again.
So all content files were ok. I'd guess this is because wordpress's index.php file handles ALL page content, so the script measures its size off the index file?...which is what I was calling into the iFrame?
Just interested to know. It would be great if the admin were full size, too!
H.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.