www.webdeveloper.com
Results 1 to 8 of 8

Thread: Still struggling with inline frame resizing.

Hybrid View

  1. #1
    Join Date
    Jul 2010
    Posts
    10

    Unhappy Still struggling with inline frame resizing.

    Site is http://halcyon-hotsprings.com

    I have a small script that is designed to resize my inline frame. Currently it works in ie, safari and chrome, but does not work in firefox or opera.

    This is a huge headache that I have been trying to solve for more than a month and am really stuck.

    The worst thing about it is that not only does it not work in firefox or opera, it makes the frame completely invisible. So the site is essentially completely broken in these two browsers.

    If anyone could help with this I would be so grateful - or even if you have a better suggestion as to how I could have the site look the same but without inline frames?

  2. #2
    Join Date
    Jun 2007
    Posts
    667
    Try it like this, noting the difference in the way the function is called:
    Code:
    <script type="text/javascript"> 
    
    function resize_iframe( ifr )
    {
      ifr.height = ifr.contentWindow.document.documentElement.scrollHeight;
    } 
    
    </script>
    
    .......
    
    <iframe id="main" name="main" src="main.html" frameborder="0" scrolling="no" width="918" height="400" marginwidth="0" marginheight="0" allowtransparency="true" onload=resize_iframe( this );>

  3. #3
    Join Date
    Jul 2010
    Posts
    10
    Oh my, I thought it worked.

    For some reason, it displays in Firefox now, but still doesn't resize correctly. It's just as if the script wasn't there at all.

    It will size it for a larger page, but doesn't pull the page back down to a smaller size when required.

    But thank-you, this is progress for sure!
    Last edited by Eleytheria; 09-20-2010 at 12:30 PM. Reason: Missed something.

  4. #4
    Join Date
    Jul 2010
    Posts
    10
    Oi, it also no longer works in IE sadly, acts just as if there is no script at all.

  5. #5
    Join Date
    Jun 2007
    Posts
    667
    Quote Originally Posted by Eleytheria View Post
    Oh my, I thought it worked.

    For some reason, it displays in Firefox now, but still doesn't resize correctly. It's just as if the script wasn't there at all.

    It will size it for a larger page, but doesn't pull the page back down to a smaller size when required.

    But thank-you, this is progress for sure!
    When I load your homepage on Fx, IE, Chrome & Opera I see the full vertical content of main.html, which is what I would expect from that script. There is no code there to limit the iframe's size.
    Last edited by Sterling Isfine; 09-20-2010 at 02:58 PM.

  6. #6
    Join Date
    Jul 2010
    Posts
    10
    It does that fine - the problem is when I browse the site - it doesn't size the new pages, pages that are shorter in length stay longer with the bottom frame half-way up the page. O_o

  7. #7
    Join Date
    Jun 2007
    Posts
    667
    Quote Originally Posted by Eleytheria View Post
    It does that fine - the problem is when I browse the site - it doesn't size the new pages, pages that are shorter in length stay longer with the bottom frame half-way up the page. O_o
    It now seems there's a bug in Firefox that reports the previous size if it's larger, which your original code tried to fix.
    This worked on a copy of your site:
    Code:
    function resize_iframe( ifr )
    {
      ifr.height = 10;
    
      ifr.height = ifr.contentWindow.document.documentElement.scrollHeight;
    }

  8. #8
    Join Date
    Jul 2010
    Posts
    10
    Now you truly are my hero - thank-you so much for all your help.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles