...

View Full Version : Dynamic expanding iframe



lala
01-10-2003, 01:37 AM
i have an iframe on my page, witch is 400Pxi wide and 200pxi high.

I also have a menu, witch points to various images on my server, and all the images have the same width (400pix:)) but not the same height.

My question is:
would it be possiple to open these images in the iframe, and make the iframe dynamicly expand and collapse according to what size image is being shown...
Alll this in order to not having to open the images in new window or refreshing the entire page.

Been searching some hours for a script, but no luck sofar...




regards .

chrismiceli
01-10-2003, 02:44 AM
you could do this.


// w/ the function to call the pic
parent.frames["iframename"].src="whatever.jpg";
parent.frames["iframename"].height=parent.frames["iframename"].images["imagename"].height;

i think, the code can probably be compressed but give it a shot.

lala
01-10-2003, 04:53 PM
Could you maybe post an example on how a working example with that code would look?

iceman
01-10-2003, 05:09 PM
This seems to work.

Variable Height IFrame Depending on loaded page.

<SCRIPT language=javascript>
<!--

function frm_onload(frmname)
{
frmname.frameElement.height = frmname.document.body.scrollHeight+20;
}

//-->
</SCRIPT>
</HEAD>
<BODY>

<A HREF="img or html link" TARGET=frm>Short page</A>
<BR>
<A HREF="img or html link" TARGET=frm>Long Page</A>
<BR>
<IFRAME ID=frm NAME=frm WIDTH=100% LANGUAGE=javascript ONLOAD="return frm_onload(frm)">
</IFRAME>

lala
01-10-2003, 06:06 PM
Yeah that works just fine.

Thanks for this :)

Shecky
01-10-2003, 06:31 PM
you're a ****ing genius.

I'm not really one to judge tho... just thought i'd say. This really helped me out

lala
01-11-2003, 02:31 PM
Is there any code you can add to make this script work in NS (7.0+), or is that out of the question since its an Iframe?

iceman
01-11-2003, 11:26 PM
can't help u on that one, sorry

ecnarongi
01-14-2003, 12:14 AM
what about making this code work for Macs IE4.0+ NS4.0+?? Can anyone have any help? All help is appreciated. Thanks

Or is there a possible work around using layers and divs??



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum