Page 1 of 1
Random image rotator using javascript
Posted: Tue May 09, 2006 1:56 am
by tamlyn
I need to display an image that changes every x seconds. The images are randomly selected from a directory on the server. I don't want any javascript in the page body and preferably none in the page at all (i.e. all in an external script). I would also like to be able to have several such images on the same page and each have a different delay. I need to make a plugin or module but I just can't work out how to set it up.
I thought of storing the images as a list in the source and using css and javascript to make them look like just one image but that seems a bit messy and I'd rather it degraded to a single static image than to a list of images (the actual images aren't that important).
Any better ideas?
Re: Random image rotator using javascript
Posted: Sat May 13, 2006 2:51 pm
by Elijah Lofgren
Re: Random image rotator using javascript
Posted: Sat May 13, 2006 2:55 pm
by tamlyn
No I need to use javascript to change the image every x seconds, like a slideshow.
Currently I'm leaning towards using ajax to fetch an xml file from the server (most likely php generated) which specifies the files to use in the slideshow. But I haven't really done much javascripting for a while now so it's quite slow work.
Re: Random image rotator using javascript
Posted: Sat May 13, 2006 8:12 pm
by Dr.CSS
have you looked at
www.dynamicdrive.com/ lots of nice JS there
mark
Re: Random image rotator using javascript
Posted: Sat May 13, 2006 8:21 pm
by alby
tamlyn wrote:
No I need to use javascript to change the image every x seconds, like a slideshow.
Currently I'm leaning towards using ajax to fetch an xml file from the server (most likely php generated) which specifies the files to use in the slideshow. But I haven't really done much javascripting for a while now so it's quite slow work.
Maybe my plugin
Image Rotator.
It's based on
www.dynamicdrive.com
Alby
Re: Random image rotator using javascript
Posted: Sat May 13, 2006 11:21 pm
by tamlyn
Thanks alby - dunno how I missed that on my initial search. It works really well and it's neat from a cms point of view though the code it creates isn't so nice (i.e. having js in the page source). But I reckon I can live with that for the time being

cheers!