PDA

View Full Version : dynamic iframe height pain



fmp
11-26-2004, 07:01 PM
:( hi all, i am trying to make my iframe to resize dynamically every page it loads in.

I have found your script: http://www.dynamicdrive.com/dynamicindex17/iframessi2.htm

This script is supposed to do exactly what i need, but for some reason, only the first page is resized, if i click on a link on that first page, the next page still has the height size of the first one...i am pulling out my hair here.

Take a look at my dev website: http://dev.fullmetalpacket.com/?section=forums&forumid=bf1942

Anyone know what is wrong? Please, i need an expert... i am not very good with javascript, only with PHP. Sorry for the weird english.

Thanks in advance.

fmp

fmp
11-27-2004, 05:31 PM
pleeeeeeeeeeeeeeeeease anyone ??

gigabites
11-29-2004, 09:10 AM
Hmmm.... I'm pulling mine too :p
Well, the script works... but after You refresh the page :D

fmp
11-29-2004, 11:25 AM
yes :(

DanielB55
03-15-2007, 11:47 AM
Something happen since 2004 ?

I have the same problem today (03-15-2007) !

Veronica
03-16-2007, 03:52 PM
I got the script to work perfectly in IE by adding

onload="parent.scrollTo(0,0);"

inbetween the iframe tags on the main page.



<iframe
onload="parent.scrollTo(0,0);" id="myframe" src="externalpage.htm" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="overflow:visible; width:100%; display:none"></iframe>


Works in IE6 and 7, but in FF, it's still buggy, especially if you go from a very long file to a very short one, a scrollbar appears, but it at least works.

The other advantage is that, with the scrollTo, when you click a link in the iframe page, the main page acts like a regular page and gets you to the top of the new file.

compuwizards
03-23-2007, 10:53 PM
I tried the on-load modification, and my problem was solved!


See it here: http://www.shopsignaturefashions.com/test2.html

The only thing is that it goes to far up, If I'm viewing products, I want to just simply go to the TOP of the FRAME (which is below the MENU)


I dont want to adjust the (0,0) because I dont want to cut out the top header at first.


Thank you


Now, Can you modified it so it can only go to the top of the FRAME, and not the TOP of the whole page?


Regards,

Fernando R

Grame
04-06-2007, 01:43 AM
I can only get my first page loading into the Iframe to resize.
When I clink on a link to open another page in the same iFrame it keeps the size of the first page loaded and then I have to hit F5 and refresh the page to resize the iframe to the new page.

I have an Index page with 8 Menu items which are hyperlinked to pages in the same domain.
I have tried to get the iFrame to update the height
I've even tried placing the onload="parent.scrollTo(0,0);" code within the href tag.
Any help would be great.

Graeme

Fusion
04-11-2007, 02:43 PM
I am also having problems with this script.
I have a html page, in which I have the iframe, in which a php page should show up.
It does, but only about 125px. The height never changes, I've tried everything.
Also, when I try to validate it I get this:


Error Line 26 column 15: there is no attribute "onload".
<iframe onload="scrollTo(0,0)" id="myframe" src="http://...
You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).


Anyone know what could be wrong? :confused:

Merrin
05-30-2007, 12:48 AM
Hello!

I'm integrating a phpBB2 forum on my site and i am trying to use this script. It works good with IE, but with FF, the iframe gets a scoll verticaly, that really dosnt scroll.

I found an other script some place. It was alot simpler and looks like this:



<HTML>
<Head>
<Script type="text/javascript">

function adjustFrame(){

window.frames.IFrame1.scrollBy(0,900);
currTop = window.frames.IFrame1.document.body.scrollTop;
if (currTop > 0)
{
currHeight = document.getElementById('dynFrame').getAttribute('height');
currHeight++;
document.getElementById('dynFrame').setAttribute('height',currHeight);
adjustFrame();
}
}

function setHeight(){

document.getElementById('dynFrame').setAttribute('height',0);
adjustFrame();
}

</Script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style></Head>
<Body>

<IFrame
Name = 'IFrame1'
Id ='dynFrame'
Src = 'http://www.settmedia.no/nidaros/phpBB2/'
onload = 'setHeight()'
marginwidth = '0'
marginheight ='0'
frameborder = '0'
vspace = '0'
hspace = '0'
Width = '750'
Height = '150'>
</IFrame>

</Body>
</HTML>

It seems to work ok, but when I try to open a section of the forum that is kinda big (long), the iframe gets a scroll, so I get a scroll inside a scroll.

I use IE 7.0 and FF 2.0.0.3

I hope to get some help with this. Kind regards.

Tbar
05-30-2007, 05:15 PM
I believe I'm using this script "out of the box" and can't seem to get it to work in FireFox at all.. always shows the scroll bar.

MSIE seems to do what I expected it to. ... size the page, no scroll bar.

www.airattack.us/todd.php

Maybe I have a total misunderstanding, but the script claims it works in FF .. yes?? Has there been a change in FF that is causing a lot of problem with this script?

The script does not call for 'name' in the iframe tag, but I've always done this. Tried both ways, but does not seem to give desired results in FF. Again, MSIE seems to work fine.

Any light on this ? Simple error on my part??

marcoj
07-06-2007, 06:33 PM
Hi there

well I've got a problem with this script too.. but a different one..

I'm using it on an online store

there's a main file with the iframes ( and it's where the script is ) and there's the online store that runs inside one of the iframes.

what happens is that, on firefox (2.0.0.4) it works perfectly
but on IE (7.0.57... and 6.0.29...), when I'm navigating inside the store (so, inside the iframe) it resizes to the maximum height but doesn't resize when the page loaded is smaller.

For example
content size = 100px -> iframe size = 100px
content size = 300px -> iframe size = 300px
content size = 200px -> iframe size = 300px
content size = 500px -> iframe size = 500px

is there anyway i can fix this?

Thanks!

marcoj
07-09-2007, 01:14 PM
anyone?

Tbar
07-09-2007, 02:32 PM
maybe this script has no support?

marcoj
07-10-2007, 12:06 PM
yeah.. seems like it doesn't

digitaldogma
11-20-2007, 11:32 PM
First off, Excellent Script!

Secondly, I had the same problem as described above. However the problem was not with the script (loaded up a couple of test pages to make sure) but with a css tag in my code. Turns out I had a wrapper div with a 100% height set on it. Once I deleted it the page worked like a charm.

Hopefully this helps.

DD