Results 1 to 5 of 5

Thread: iFrame Javascript resize with switch content menu

  1. #1
    Join Date
    Aug 2005
    Location
    Oklahoma
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default iFrame Javascript resize with switch content menu

    Okay, here's the problem. I have this site I'm currently building, http://www.towpc.com/ke5ehi/, and I have an iFrame for the main content (controlled by the menu on the left - item's with a ' * ' haven't been made yet). When you load the satellite page, it resizes fine, but when you load the chaser-on-the-road > on-the-road page (which has the switch content menu), the javascript only sizes the iFrame to the collapsed menu state, so if you expand any of the items, the page is cut-off. Any help would be appreciated (I'm still not that good on some of this )

    This is the onload handler for each page within the iFrame:

    <body onload="if (parent.adjustIFrameSize)
    parent.adjustIFrameSize(window);" topmargin=0 leftmargin=0>

    This is the javascript for the main page:

    <script type="text/javascript">
    function adjustIFrameSize (iframeWindow) {
    if (iframeWindow.document.height) {
    var iframeElement = document.getElementById
    (iframeWindow.name);
    iframeElement.style.height = iframeWindow.document.height + 'px';
    iframeElement.style.width = iframeWindow.document.width + 'px';
    }
    else if (document.all) {
    var iframeElement = document.all[iframeWindow.name];
    if (iframeWindow.document.compatMode &&
    iframeWindow.document.compatMode != 'BackCompat')
    {
    iframeElement.style.height =
    iframeWindow.document.documentElement.scrollHeight + 'px';
    iframeElement.style.width =
    iframeWindow.document.documentElement.scrollWidth + 'px';
    }
    else {
    iframeElement.style.height =
    iframeWindow.document.body.scrollHeight + 'px';
    iframeElement.style.width =
    iframeWindow.document.body.scrollWidth + 'px';
    }
    }
    }
    </script>

  2. #2
    Join Date
    Aug 2005
    Location
    Oklahoma
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    ...is there a way to maybe get the javascript to read the expanded switch menu and set the iframe to that size?

  3. #3
    Join Date
    Aug 2005
    Location
    Oklahoma
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    is there a way to set a manual document length and just make the iframe a pre-determined size?
    Last edited by KE5EHI; 08-15-2005 at 01:52 AM.

  4. #4
    Join Date
    Aug 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I use div tags and define the proportions in a css file. I imagine that you can define the dimensions of an iframe with and ID using css as well.

  5. #5
    Join Date
    Aug 2005
    Location
    Oklahoma
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Moved this thread

    I've re-done a little, but now it's all Dynamic Drive script, so I've continued this thread in the Dynamic Drive forum here

Bookmarks

Posting Permissions

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