Previous |
Play/Pause |
Next
Version 2 changes:
- Added links for Previous, Next and Play/Pause toggle with "onclick" handler for each. Note the 1 and -1 control the direction (previous/next)
- <a href="#" onclick="updateImage(-1)">Previous</a> |
<a href="#" onclick="playSlides()">Play/Pause</a> |
<a href="#" onclick="updateImage(1)">Next</a>
- Select View Source from THIS page and select the complete <script> tag and then copy and paste it into your page in the <head> tag.
- Save and test page.
NOTES:
- The setInterval function is set to a variable called play and the number 1 added as an argument to control the initial direction.
- The playSlides function is wrapped around the play variable to pause and play the slideshow.
- The "window.clearInterval(play)" method is used to stop the slideshow.
- The following variables to the top of the code along with the other variables:
- var direction;
- var pause = false;
var play;
- The imageIndex variable has been updated to:
- imageIndex = imageIndex + direction;
- The variable direction has been added to the updateSlide() function to pass in the value -1 or 1.