Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: dynamic iframe height pain

  1. #1
    Join Date
    Nov 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question dynamic iframe height pain

    hi all, i am trying to make my iframe to resize dynamically every page it loads in.

    I have found your script: http://www.dynamicdrive.com/dynamici...iframessi2.htm

    This script is supposed to do exactly what i need, but for some reason, only the first page is resized, if i click on a link on that first page, the next page still has the height size of the first one...i am pulling out my hair here.

    Take a look at my dev website: http://dev.fullmetalpacket.com/?sect...forumid=bf1942

    Anyone know what is wrong? Please, i need an expert... i am not very good with javascript, only with PHP. Sorry for the weird english.

    Thanks in advance.

    fmp

  2. #2
    Join Date
    Nov 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    pleeeeeeeeeeeeeeeeease anyone ??

  3. #3
    Join Date
    Sep 2004
    Location
    Indonesia
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hmmm.... I'm pulling mine too
    Well, the script works... but after You refresh the page

  4. #4
    Join Date
    Nov 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    yes

  5. #5
    Join Date
    Mar 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Something happen since 2004 ?

    I have the same problem today (03-15-2007) !

  6. #6
    Join Date
    Feb 2007
    Posts
    293
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default possible fix

    I got the script to work perfectly in IE by adding

    onload="parent.scrollTo(0,0);"

    inbetween the iframe tags on the main page.

    Code:
    <iframe 
    onload="parent.scrollTo(0,0);" id="myframe" src="externalpage.htm" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="overflow:visible; width:100%; display:none"></iframe>
    Works in IE6 and 7, but in FF, it's still buggy, especially if you go from a very long file to a very short one, a scrollbar appears, but it at least works.

    The other advantage is that, with the scrollTo, when you click a link in the iframe page, the main page acts like a regular page and gets you to the top of the new file.

  7. #7
    Join Date
    Mar 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Works Great!

    I tried the on-load modification, and my problem was solved!


    See it here: http://www.shopsignaturefashions.com/test2.html

    The only thing is that it goes to far up, If I'm viewing products, I want to just simply go to the TOP of the FRAME (which is below the MENU)


    I dont want to adjust the (0,0) because I dont want to cut out the top header at first.


    Thank you


    Now, Can you modified it so it can only go to the top of the FRAME, and not the TOP of the whole page?


    Regards,

    Fernando R

  8. #8
    Join Date
    Apr 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I can only get my first page loading into the Iframe to resize.
    When I clink on a link to open another page in the same iFrame it keeps the size of the first page loaded and then I have to hit F5 and refresh the page to resize the iframe to the new page.

    I have an Index page with 8 Menu items which are hyperlinked to pages in the same domain.
    I have tried to get the iFrame to update the height
    I've even tried placing the onload="parent.scrollTo(0,0);" code within the href tag.
    Any help would be great.

    Graeme

  9. #9
    Join Date
    Apr 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I am also having problems with this script.
    I have a html page, in which I have the iframe, in which a php page should show up.
    It does, but only about 125px. The height never changes, I've tried everything.
    Also, when I try to validate it I get this:
    Code:
    Error Line 26 column 15: there is no attribute "onload".
    <iframe onload="scrollTo(0,0)" id="myframe" src="http://...
    You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).
    Anyone know what could be wrong?

  10. #10
    Join Date
    May 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hello!

    I'm integrating a phpBB2 forum on my site and i am trying to use this script. It works good with IE, but with FF, the iframe gets a scoll verticaly, that really dosnt scroll.

    I found an other script some place. It was alot simpler and looks like this:

    Code:
    <HTML>
    <Head>
    <Script type="text/javascript">
    
    function adjustFrame(){
    
    window.frames.IFrame1.scrollBy(0,900);
    currTop = window.frames.IFrame1.document.body.scrollTop;
    if (currTop > 0)
    {
    currHeight = document.getElementById('dynFrame').getAttribute('height');
    currHeight++;
    document.getElementById('dynFrame').setAttribute('height',currHeight);
    adjustFrame();
    }
    }
    
    function setHeight(){
    
    document.getElementById('dynFrame').setAttribute('height',0);
    adjustFrame();
    }
    
    </Script>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
    <!--
    body {
    	margin-left: 0px;
    	margin-top: 0px;
    	margin-right: 0px;
    	margin-bottom: 0px;
    }
    -->
    </style></Head>
    <Body>
    
    <IFrame
    Name = 'IFrame1'
    Id ='dynFrame'
    Src = 'http://www.settmedia.no/nidaros/phpBB2/'
    onload = 'setHeight()'
    marginwidth = '0' 
    marginheight ='0' 
    frameborder = '0' 
    vspace = '0' 
    hspace = '0'
    Width = '750'
    Height = '150'>
    </IFrame>
    
    </Body>
    </HTML>
    It seems to work ok, but when I try to open a section of the forum that is kinda big (long), the iframe gets a scroll, so I get a scroll inside a scroll.

    I use IE 7.0 and FF 2.0.0.3

    I hope to get some help with this. Kind regards.

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
  •