Cycle custom timeout for last slide
In the cycle plugin, if you don't want the timeout to be equal for all slides, you can write a function to calculate the timeout on a slide-by-slide basis. This function takes the basic form:
- function calculateTimeout(currSlide, nextSlide, options, isForward) {
- var index = options.currSlide;
- if (index == 0) {
- return ...;
- } else if (index == ...) {
- return ...;
- } else {
- return ...;
- }
- }
It's easy to see how to set the timeout for the first slide: Just test for index == 0. But how do you identify the last slide if you don't know how many slides are in the show?
Many thanks.