kat-uk
09-20-2005, 01:25 PM
Script: Fade-in slideshow
http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm
I have used this script on a site where the "slideshow" is in a table that is centered vertically - see the test site at http://server.cubeconnection.co.uk:8386/profile.htm If you resize the window (in height or maximise it) you will see that the central display area remains centered in the window, but the slideshow stays relative to the top of the broswer window and hence moves out of position. Viewing in Firefox 1.06 and Opera 7 and everything is OK, so just an IE problem.
I have identified the lines that cause the problem, which is the nested DIVs (about 33 lines down) as shown below:
<div style="position:relative; width:'+slideshow_width+'; height:'+slideshow_height+'; overflow:hidden">
<div id="canvas0" style="position:absolute; width:'+slideshow_width+'; height:'+slideshow_height+'; top:0; left:0; filter:alpha(opacity=10); -moz-opacity:10">
</div>
<div id="canvas1" style="position:absolute; width:'+slideshow_width+'; height:'+slideshow_height+'; top:0; left:0; filter:alpha(opacity=10); -moz-opacity:10; visibility: hidden">
</div>
</div>
If I take out the "position:relative" in the first DIV then it works OK in IE but then fails in Firefox / Opera as they then position the slideshow at location 0,0 as specified.
Because of this I then had the cunning idea of changing the if statement that displays these DIVs from:
if (ie4||dom)
to
if (ie4)
write out IE DIVs
else if (dom)
write out Firefox / Opera DIVs
else
write out image as is
but that didn't work as Opera identifies itself as IE4 using the IE4 DIVs and failing. I would need to detect Opera as well!
There has to be a better way, but I can't see it. Is there an easier answer?
As this method of using the DIVs in this way is used in other scripts of course they will also have the same problem.
Thanks and looking forward to any fixes.
Rob
http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm
I have used this script on a site where the "slideshow" is in a table that is centered vertically - see the test site at http://server.cubeconnection.co.uk:8386/profile.htm If you resize the window (in height or maximise it) you will see that the central display area remains centered in the window, but the slideshow stays relative to the top of the broswer window and hence moves out of position. Viewing in Firefox 1.06 and Opera 7 and everything is OK, so just an IE problem.
I have identified the lines that cause the problem, which is the nested DIVs (about 33 lines down) as shown below:
<div style="position:relative; width:'+slideshow_width+'; height:'+slideshow_height+'; overflow:hidden">
<div id="canvas0" style="position:absolute; width:'+slideshow_width+'; height:'+slideshow_height+'; top:0; left:0; filter:alpha(opacity=10); -moz-opacity:10">
</div>
<div id="canvas1" style="position:absolute; width:'+slideshow_width+'; height:'+slideshow_height+'; top:0; left:0; filter:alpha(opacity=10); -moz-opacity:10; visibility: hidden">
</div>
</div>
If I take out the "position:relative" in the first DIV then it works OK in IE but then fails in Firefox / Opera as they then position the slideshow at location 0,0 as specified.
Because of this I then had the cunning idea of changing the if statement that displays these DIVs from:
if (ie4||dom)
to
if (ie4)
write out IE DIVs
else if (dom)
write out Firefox / Opera DIVs
else
write out image as is
but that didn't work as Opera identifies itself as IE4 using the IE4 DIVs and failing. I would need to detect Opera as well!
There has to be a better way, but I can't see it. Is there an easier answer?
As this method of using the DIVs in this way is used in other scripts of course they will also have the same problem.
Thanks and looking forward to any fixes.
Rob