Cross browser image slideshow
Okay, so here's my attempt at an automajical cross browser image slideshow, with transparency fading using Javascript & PHP.
It uses PHP to pull the images from a chosen folder, then a bit of Javascript to fade between the images. It even has easing on the fades. It also preloads all the images before starting the show, and has a few selectable options, such as random order, transition timer/speed.
I initially wrote this as an active desktop page so I could have random photos on my Windows box (work), like it's very eay to do on my OSX box (home). This script also doesn't fall over if you have lots of images to load, as it preloads them prior to starting the show.
If you've not got javascript enabled, you just get the first image (which can be set as random or not). No CSS, you get the show, without the fancy fading stuff. No javascript & css, well just combine the previous two.
See the thing in action here
Download it here
Credit to all the many hundreds of slideshows I picked through to come up with this. Particular credit to Dynamic Drive and Clagnut , though I've been working on this for that long that I worked out the mozilla opacity flicker workaround seperately from both of these. This article inspired my preload function. Oh and old Robert Penner, who's easing scripts work a treat. Images from various free stock photo sites, so pilfer those at your own risk.
25 Feb 2005 by GSGD
7 comments
by Jay @ 08 Jan 2006 01:39 am
This may be a dumb question, but does this script load images on demand or does it load them all at once?
by GSGD @ 08 Feb 2006 10:20 am
by Duncan @ 30 Mar 2006 01:01 am
Howdy, thanks for this script. It's very useful.
I have a little problem though... we're using it to show property listings - it automatically cycles through the pages using a javascript refresh. the slideshow doesn't start once the images are cached and the page shows again. is there a function I can call onLoad to start the slide show? The image array is created by php rather than from the directory listing. thanks again
by Duncan @ 30 Mar 2006 03:43 am
oh neat, I've narrowed it down to a bug in Safari. I suspect it's a refresh bug or something - it just doesn't work upon successive displays of the page. Any ideas will still be useful
by Duncan @ 30 Mar 2006 04:34 am
it works fine if I click the pause/run link (but we want it to run automagically)
sorry for multiple posts
by Sam Stevens @ 31 Aug 2006 09:02 pm
This is really nice, thank you! One small observation: in Firefox 1.5.0.6, I get a very brief flicker between the image fades. Flawless in IE. Ideas?

by roto @ 02 Mar 2005 02:24 am
Excellent!