SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member jitu78's Avatar
    Join Date
    Aug 2006
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Auto fit iframe to content

    Hi All,

    I am working on site where I am using iframes for dynamic html files.
    Each html file having own length and my iframe height is fixed.

    How can I set auto height for each page coming in iframe?


    - Jits
    globtier.com
    Globtier Solutions
    Outsource IT Smartly

  2. #2
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    Without JavaScript it would be a little hard I don't quite follow exactly what you are after if the IFRAME is fixed it stays fixed.

    The content file won't resize the IFRAME dimensions with HTML alone are you sure you want an IFRAME.

  3. #3
    SitePoint Wizard ryanhellyer's Avatar
    Join Date
    Oct 2006
    Location
    New Zealand
    Posts
    2,323
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This can be done using Javascript but I don't have a link at hand. Some Google searching should find an example of it.

    A better alternative would be to use an include statement and just stick the html into your existing page. Although this is not always suitable.

    An example of a PHP include statement:
    PHP Code:
    <?php require("blabla.html"); ?>
    Ryan,

  4. #4
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,095
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    An 'iframe type display' with the scroll bar can be gained with CSS
    CSS
    Code:
    #fake_iframe {
      overflow: auto;
      height: 200px;
      width: 200px;
    }
    HTML
    Code:
    <div id="fake_iframe">Some content that will make a scroll bar appear if neccessary....</div>

  5. #5
    SitePoint Wizard ryanhellyer's Avatar
    Join Date
    Oct 2006
    Location
    New Zealand
    Posts
    2,323
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by markbrown4 View Post
    An 'iframe type display' with the scroll bar can be gained with CSS
    I think Jits is trying to remove the scroll bar, not create one.

    Ryan,

  6. #6
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,095
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    Good point

  7. #7
    SitePoint Member jitu78's Avatar
    Join Date
    Aug 2006
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, Ryanhellyer is saying right.

    Sorry for not being clear!

    When you put iframe somewhere to call any external file into that iframe, then you have to set iframe height. Right!

    Now I want to set page height as per external page height so that no scroll appears around iframe.

    And, my problem is that my contents are dynamic page height will vary page to page.

    Is there any way to set iframe height on runtime automatically.

    I had tried it by javascript but there was issue with OPERA browser.

    Thanks
    Jits
    Globtier Solutions
    Outsource IT Smartly


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
  •