OZONE Asylum
Forums
DHTML/Javascript
Javascript Online Checker (Am i online or offline)
This page's ID:
28659
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
Hello folks. Sorry if for posting into this old thread but I was led here by Google. Here is a fading script for an Image Gallery I am looking to fix. It works with IE and Safari but not with Firefox and Netscape. Actually, when I say it doesn't work, I mean you have to refresh the page before the fade happens and once that is done once, it works on that image for that session. Here is the code [code]// Fade In Script if (document.getElementById) { document.write("<style type='text/css'>.giThumbImage img {visibility:hidden;} #gsSingleImageId img {visibility:hidden;} </style>"); } function start() { if (SingleImageDiv = document.getElementById('gsSingleImageId')) { var imageCollTemp = SingleImageDiv.getElementsByTagName('img'); var theimage = imageCollTemp[0]; theimage.id = 'gTheSingleImage'; CheckIfComplete('gTheSingleImage',1); } } function CheckIfComplete(ImageId,ImageNumber) { ImageObj = document.getElementById(ImageId); if (ImageObj.complete == false) { window.setTimeout("CheckIfComplete('"+ImageId+"')", 100); } else { startFade(ImageId,ImageNumber); } } function startFade(imageId,ImageNumber) { var ImageFromId = document.getElementById(imageId); setOpacity(ImageFromId, 0); ImageFromId.style.visibility = 'visible'; window.setTimeout("fadeIn('" + imageId + "', 0)", (ImageNumber*600)); } function fadeIn(objId,opacity) { if (document.getElementById) { obj = document.getElementById(objId); if (opacity <= 100) { setOpacity(obj, opacity); opacity += 5; window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 100); } } } function setOpacity(obj, opacity) { opacity = (opacity == 100)?99.999:opacity; // IE/Win obj.style.filter = "alpha(opacity:"+opacity+")"; // Safari<1.2, Konqueror obj.style.KHTMLOpacity = opacity/100; // Older Mozilla and Firefox obj.style.MozOpacity = opacity/100; // Safari 1.2, newer Firefox and Mozilla, CSS3 obj.style.opacity = opacity/100; }[/code] I understand after Googling this issue that the fade into each other thing needs the image to be loaded before it works which from my understanding of this code is why the writer checks whether the image has loaded with function CheckIfComplete() before running the actual fade script. Now for some reason, I suspect Firefox and Netscape return an incorrect answer in that function and that is why it doesn't work. I just suspect and wonder if you guys that cast your experienced eyes over this and give some clues to fixing it. Note that if the page is refreshed, then it runs properly. Works fine on IE and Safari. Sorry if this seems obvious or a bit silly, I have no experience with this sort of thing and have been searching high a low for an answer. Thanks for your assistance [small](Edited by [url=http://www.ozoneasylum.com/user/6559]dayo[/url] on 07-19-2007 20:32)[/small]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »