Weborum Webmaster Forum > resizing iframes
Help - Search - Members - Calendar
Full Version: resizing iframes
Weborum Webmaster Forum > Web Page Design > Javascript
lexuscat
Does anyone know where to find a script to size an iframe to an img src? I have multiple thumbnails with larger images to display, once clicked, in my iframe but all my fullsize images aren't the same size. I need the iframe to be the size of the image. Please help!!
Willy Duitt
Why not just display the image in a division or span and allow the division/span to expand/collapse according to the size of the image??
lexuscat
Then how do I call my thumbnails to the div or span to display the larger image?
leo
maybe someone would like to correct me if i'm wrong but try this
inbetween your head tags:
CODE

<script>
function runit(w,h)
{
    var ifr=document.getElementById("frame-name")
    ifr.style.width=w;
    ifr.style.height=h;
}
</script>


and with each thumbnail set what size the iframe has to be to accomodate the target image

<a href="image.jpg" target="frame-name" onclick="runit(100,100)">thumbnail1</a>
<a href="image.jpg" target="frame-name" onclick="runit(200,200)">thumbnail2</a>
<a href="image.jpg" target="frame-name" onclick="runit(300,300)">thumbnail3</a>
Willy Duitt
QUOTE(lexuscat @ Jan 18 2005, 11:41 AM)
Then how do I call my thumbnails to the div or span to display the larger image?
[right][snapback]21797[/snapback][/right]


Don't you read the replies to your posts?
I showed you how to do that on another thread of yours...
But forget about it.... Do it anyway you want... Makes no never mind to me...

......Willy
leo
i hadn't noticed that your answer included a resizing feature, i wouldn't have bothered trying to find the one i posted above if i'd realised that.

Lexus please refer to the other thread.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.