www.webdeveloper.com
Results 1 to 5 of 5

Thread: how to make an IFRAME shrink?

  1. #1
    Join Date
    Jul 2005
    Posts
    197

    how to make an IFRAME shrink?

    hi,
    i have an iframe with only one image inside.
    i want the IFRAME to be exactly the size of the image, how do i do this?

    p.s: i have alot of images in a variety of sizes

  2. #2
    Join Date
    May 2004
    Location
    Manhattan NY
    Posts
    6,028
    Well the 1st question to be asked is, can what you want to do be accomplished without use of an iframe?

  3. #3
    Join Date
    Jul 2005
    Posts
    197
    1) why??

    2) no, kuz iframe is the only thing that comes in a layer ABOVE all.. especially selects which i have a few.

    3) my goal is to make kind of a "popup" window without it being a popup.
    i hate the way it looks, and with FF with some extension the popup will open in a tab instead of new window.
    if this will be the only solution i will make a popup with a script to shrink to images size. but only as a last resort!!

  4. #4
    Join Date
    Jul 2005
    Posts
    197
    bump

  5. #5
    Join Date
    Apr 2003
    Location
    UK
    Posts
    2,203
    Try this


    PHP Code:
    <script type="text/javascript"
    <!--
    function 
    resize_iframe(){
    document.getElementById("sizeframe").width=null
    document
    .getElementById("sizeframe").width=window.frames["sizeframe"].document.body.scrollWidth
    document
    .getElementById("sizeframe").height=null
    document
    .getElementById("sizeframe").height=window.frames["sizeframe"].document.body.scrollHeight
    }
    // -->
    </script>

    <iframe id="sizeframe" name="sizeframe" src="yourpage.htm" width=300 height=100 scrolling="yes" frameborder="yes" onload=resize_iframe()></iframe> 

Thread Information

Users Browsing this Thread

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

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