How to implement a slide show that runs through once and then stops
A slide show is where a number of images are displayed in sequence one after another. Typically with a slide show after the first image is shown the slide show will loop back to the first once and start again - if this is the type of slide show you are after then click the following link for guidance: automatic slide show. This article provides a means to show a slideshow only the once, stopping after the last image, an example of which is shown here: (which should appear to slowly count down.)
To achieve this effect three things are required:
This is a standard HTML image and is the image displayed before the slide show starts. The only things to bare in mind are the height and width of the image must be pre-set and that the image must be given a unique id. These are dealt with below under step 3. As an example, this page uses the following HTML for its image:
<img border="0" src="http://www.cryer.co.uk/brian/images/5_key.gif" align="top" width="35" height="35" id="CountDown">
If this script were to be used in a number of pages then it might be best included in a separate script file instead of being embedded directly in a web page.
The final step is to establish what images are to be shown as part of the slideshow and how long each image is to be displayed before moving onto the next one. As an illustration, this page uses the following:
1. pictureName The picture-name is the identifying name given to the image. This identifies the image in which to run the slide show. This image will be replaced with each slide show image in turn. (The name was specified as part of step 1 above "An image placeholder"). In HTML the picture name is specified by including a statement of the form:id="pictureName"
2. imageFiles This is a string containing the names of the source files for each image to be displayed. Include a semi-colon (';') as a separator between the names of each image file.
It is very important that each image is the same size (height and width) as the original - or that it has the same aspect ratio (ratio of height to width) as the original. This is because each image is loaded into the same area or space that the original image occupied. If this images are not the same size then the browser will stretch the image to fit (and for example thus give the impression of very fat or very thin people) and this may be undesirable.
3. displaySecs This is the number of seconds that each image is to be displayed for.
Other points to note
Should you need to restart the slideshow then you will need to the
function again. For example:
The only problem with this is that if you trigger the restart before the previous slide show has completed then you will end up having both running and trying to update the image. It will run, but just look a little odd!