Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    Dec 2002
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Dynamic expanding iframe

    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 .

  • #2
    Regular Coder
    Join Date
    Sep 2002
    Location
    Louisiana
    Posts
    576
    Thanks
    0
    Thanked 0 Times in 0 Posts
    you could do this.
    Code:
    // 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.

  • #3
    New Coder
    Join Date
    Dec 2002
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Could you maybe post an example on how a working example with that code would look?

  • #4
    New to the CF scene
    Join Date
    Jun 2002
    Location
    MN
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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>

  • #5
    New Coder
    Join Date
    Dec 2002
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yeah that works just fine.

    Thanks for this
    Last edited by lala; 01-10-2003 at 07:39 PM.

  • #6
    Regular Coder
    Join Date
    Dec 2002
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts
    you're a ****ing genius.

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

  • #7
    New Coder
    Join Date
    Dec 2002
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?

  • #8
    New to the CF scene
    Join Date
    Jun 2002
    Location
    MN
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    can't help u on that one, sorry

  • #9
    Regular Coder
    Join Date
    Jun 2002
    Location
    Northern NJ
    Posts
    404
    Thanks
    0
    Thanked 1 Time in 1 Post
    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??
    Last edited by ecnarongi; 01-14-2003 at 12:26 AM.
    I would rather be a lion for a day than a lamb that lives forever.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •