PDA

View Full Version : SSI Script II, problem with absolute positioned divs in Firefox



Kevin Mackey
08-28-2006, 08:50 PM
1) Script Title: Iframe SSI script II

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/iframessi2.htm

3) Describe problem:
I'm using the SSI2 script for dynamically resizing my web page to fit the iframe content. It was working perfectly fine in Explorer, but when I tried opening the page in Firefox, the iframe was being shrunk vertically (to what appears to be the default iframe vertical size).

The code worked fine from the website in question, so I tried removing all other scripts from my page, and stripping it down to the very basics, but it still wasn't working. So finally I took a look at the page I was loading into the iframe, and tried making some changes to it.

What I discovered is that a loaded page set up like this works fine:


...
<div>
<img src="content_sample.jpg">
</div>
...

but one set up like this:


...
<div style="position: absolute">
<img src="content_sample.jpg">
</div>
...

causes the problem I mentioned above with Firefox. My questions are:

A) Does this constitute a bug in the aforementioned script? and
B) Is there any way to make a version of the SSI2 script that works with Firefox?

blm126
08-28-2006, 11:33 PM
A)Probably Not
B)I don't know
My guess is that due to the nature of absolutely positioned boxes(Taken out of normal flow), Firefox is "screwing up". It does not count them as part of scrollHeight. It may be possible to test for absolutely positioned elements and if found add their height to the iframe total.

Kevin Mackey
08-29-2006, 12:45 AM
Well, if someone could find a fix for this, it would really help me. I've got a client who wants this page up ASAP, and it would be nice if I could get this feature working in both browsers.

(Cursing the ongoing lack of universal browser standards, not for the first time...)

jscheuer1
08-29-2006, 04:53 AM
Don't use absolute positioning of content on pages loaded into an iframe using this script unless it has no impact upon the apparent height of the page. FF is actually doing the right thing because an absolutely positioned element adds no height to the page.

An alternative would be to set the height of the body of the page but, this could cause other problems under some circumstances, ex:


<body height="600">

Substitute the actual height that you want your page to be for the 600 in the above.

Kevin Mackey
08-29-2006, 10:09 PM
Unfortunately, I need the absolute positioning in order to seamlessly fit the iframe graphics together with the main page.

I tried adding a <body height="">, but it did not work. I assume that some other part of the script will need to be altered to accomodate that?

There will NOT be any external content loaded into these iframes, so I can definitely go ahead and include a specified height in them, either as you described above, or in a variable that I specify. I just need to figure out how to adjust the SSI2 script to take that information and use it instead of trying to automatically figure it out. Any suggestions?

jscheuer1
08-30-2006, 05:55 AM
That should have worked. However, when I tested it here, it did not. But, this did:


<body style="height:880px;">

Kevin Mackey
09-02-2006, 04:06 PM
Thanks, that seems to have done it! :)