[thelist] javascript slide-show
Sam Foster
sam at sam-i-am.com
Thu Jul 29 15:48:41 CDT 2004
>> My initial thoughts are to
>> use javascript to create a timer, and then refresh the page with a
>> link to
>> the next image at intervals of n seconds. Does this make sense? Is
>> their an
>> easier client-side solution I'm overlooking?
this is not so weird a request to my mind.. I've built several -its a
classic javascript task.
You need
* your input - all the image paths,
* your page template (do the images need centering, captions? borders,
next/back links?
* script to handle the above.
Your input might be a hardcoded array or paths, or I've used a framed
arrangement in the past and read in the links array of a hidden page
containing links to each image in a hidden frame.
Then you need to display the image: with document.write or using DOM
methods.
And you need a timer - preferably started by an onload event so things
get a chance to load before you think about loading in the new stuff.
And you need an iterator - some way of tracking which image number to
display. I tend to put this in the querystring and read the value in
when the page loads. The advantage here is that you get
back/nextfunctionality for free, and you can easily jump around the
slideshow by simply linking back to the slideshow page and appending the
correct parameter value. (and you can bookmark or link directly to a
particular "slide" in the slideshow)
hth
Sam
More information about the thelist
mailing list