I wrote a simple javascript image rotator which picks a random image on each page load. The issue is that if i use a default image, that default image will show up for a second before the javascript loads and replaces it. Obviously if someone has javascript disabled i want them to see an image. How can i have a default image without a flickering of the default image.
It sounds like you want to change the page HTML before window.onload fires (because at that point the default image has been displayed already).
You need to attach your javascript function to a "DOMContentLoaded" or commonly called domready event. Dean Edwards provided us a fantastic cross-browser implementation http://dean.edwards.name/weblog/2006/06/again/.
Hope that helps :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With