Preloading script test page Version 0.9.2 / 16 july 2005.
See the source for details about the script.
Please read the tests and comments at the end of image to see where we are standing in this last version.
See the source for details about the script.
Please read the tests and comments at the end of image to see where we are standing in this last version.
MAC: FF, Firebird, Opera 7.54, Opera 8, Safari 1.3, Camino 0.8.2, Shiira, SunriseBrowser... Ok
PC: FF ok.
PC & MAC: IE not working...
So the script is widely cross-browser working except for IE on both platforms...
- I added an appendChild "span" within the "p" so that i could give the text a margin-left. Otherwise all other margins left-margin values would apply on the loader and we'll see what's happening behind. A better idea would be to assign a class="loadMsg" to the p so we would have more options for the display with css... Any suggestions on this is welcome.
- FIXED in V. 0.9.2 with a: var parent = document.getElementById("content"); parent.removeChild(mask);
Another issue is that if the user has css turned off and Js on, wich is quite more frequent than the opposite, the loading text is not removed and stays in the page. I first thought to switch, at the end of the script, as you did, the class for the span to done... But I haven't found yet how to add some class for the span in the initMask part of the script... If i connect it to a class that has a display:none property though a getElementsByTagName for the tag span... Then all the span in my page will hide...
Maybie another solution would be to remove the node p... But we haven"t got yet an Id or class to target...
- Last issue: this script wonderfully works for a page with one image... I think you'll guess this one... What if i have other images ( small ones ) and only want to target this one... We could target the image to be checked with an Id or a class... This would also allow a very simple re-use of the script and loading an array of images ( wich would the class applied ). A basic idea would be: if img.className.match("imageToLoad")
- For IE we could use the IE property that Troy III mentioned in an earlier mail onreadystatechange.
I'm pasting below a part of the doc i've found on the Microsoft site.
Roger suggested today, July 16, to try first to achieve this cross-browser without this property.
If we don't succeed then we'll use this property.
"When working with behaviors, wait for the onreadystatechange event to fire and verify that the readyState property of the element is set to complete to ensure that the behavior is completely downloaded and applied to the element. Until the onreadystatechange event fires, if you use any of the behavior-defined members before attaching the behavior to the element, a scripting error can result, indicating that the object does not support that particular property or method."
This property can be used inline or in a script...
Thank you all for having the patience to read those lines...
I strongly appreciate.
Guillaume