Forum Moderators: open

Message Too Old, No Replies

dynamically resize an iFrame for Safari?

Tag "100%" needs to be replaced with reproportioning code

         

toolbar

1:48 pm on Apr 24, 2004 (gmt 0)

10+ Year Member



I'm using an iFrame to receive largely photographic content. It's imbedded in a table of sliced images, like a picture in a picture frame, and this frame needs to resize with the page: so I need to set the iFrame at 100% height and width. It looks gorgeous in Explorer, but Safari apparantly rejects percentages for iFrames, so the whole thing just implodes. If I were to do it with normal frames, the relative sized frames would resize over the sliced images. Horreur!

Javascript Question: is it possible to write script that uses the available browser window width (is that the same as "screen"?) as the given from which to compute the size of the iframe?

I'm doing my best to learn javascript fast, but I'm not over the learning curve yet. (between working like a dog and having a life, it might take a while.)

The page in question can be accessed through my profile, on all pages except the intro page. Mac users beware! I'm workin on it.

Bernard Marx

8:27 pm on Apr 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try this (after the code for the iframe element):

<script>
var ifr = document.getElementById("yourIframeId")
// then
ifr.width = screen.width
ifr.height = screen.height
// or
ifr.style.width = screen.width
ifr.style.height = screen.height
</script>