Results 1 to 5 of 5

Thread: Iframe SSI script II with Content Switch Menu problem

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

    Default Iframe SSI script II with Content Switch Menu problem

    Okay, I upgraded to the Iframe SSI script II in hopes of solving my issue with sizing the iframe window to fit a Switch Content menu, but the SSI script II only resizes the iframe to the size of the collapsed menu and when you try to expand one of the items, it's cut off. Is there a way to either set the page length manually somehow or put a tag around the content in the page so the SSI script II will use the entire document (expanded) to set the window? I'm not great a coding, so I can't figure this out just tinkering with it. Thanks.

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

    Default

    The page is here if anyone wants to take a look at it

    http://www.towpc.com/ke5ehi/

    The page I'm having problems with is the Chaser On-the-Road > On-the-Road Weather

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    The two scripts do not play well together as, one resizes the iframe onload of the iframe's content page while the other resizes that page onclick. You could reload the switch page onclick (or on use of its main function) but, that will be a drag for slower connections. If you want to go that route anyway, add this code (highlighted red):
    Code:
    function expandcontent(curobj, cid){
    var spantags=curobj.getElementsByTagName("SPAN")
    var showstateobj=getElementbyClass(spantags, "showstate")
    if (ccollect.length>0){
    if (collapseprevious=="yes")
    contractcontent(cid)
    document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none"
    if (showstateobj.length>0){ //if "showstate" span exists in header
    if (collapseprevious=="no")
    showstateobj[0].innerHTML=(document.getElementById(cid).style.display=="block")? contractsymbol : expandsymbol
    else
    revivestatus()
    }
    }
    if (window.location.reload)
    window.location.reload( true );
    else if (window.location.replace)
    window.location.replace(unescape(location.href))
    else
    window.location.href=unescape(location.href)
    }
    into the function 'expandcontent' as shown. That should work alright in an iframe like you have it (untested, works on a single page).
    Or, you could set the switch script to:
    Code:
    var collapseprevious="yes" //Collapse previously open content when opening present? (yes/no)
    and insert enough white space at the bottom of the switch page so that it will start out tall enough.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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

    Default

    Thanks!

  5. #5
    Join Date
    Oct 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Here's a solution

    I know it's a little late for you now, but this may help others:

    <script>
    function fitIframePoll(){
    if (frames["ifr"].document.title != '' && !(!frames["ifr"].document.body))
    document.getElementById("ifr").height = frames["ifr"].document.body.getElementsByTagName("TABLE").item(0).scrollHeight + 20;
    setTimeout('fitIframePoll()',2000);
    }
    fitIframePoll();
    </script>

    This works by polling the iframe every 2 seconds to set it's size to the size of a table in the iframe. It worked for me because I knew the iframe would always contain a table tag just after the body. You might need to find a tag that will always be in your pages or figure out how to find the height of the whole document. It's been tested and works in mozilla and IE, but doesn't work for Opera (can't figure out how Opera refers to iframes, I don't know if anyone actually uses it any more anyway).

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
  •