I would like to start my slide show on the second to last slide of the sieres. I know how to set the startingSlide option with a number:
startingSlide 3
But is there a way to create that number with an expression and a variable:
startingSlide (Variable for the total number of slides - 2)

Comments

andyanderso’s picture

Title: How to start a slideshow on the second to last slide of the seires? » One possible way to do this?

I have figured out one way to do this by altering the jquery.cycle.all.js code by changing opts.startingSlide = 0; to this opts.startingSlide = els.length - 1; like this:

if (opts.startingSlide !== undefined) {
		opts.startingSlide = parseInt(opts.startingSlide,10);
		if (opts.startingSlide >= els.length || opts.startSlide < 0)
// change this: opts.startingSlide = 0; to this opts.startingSlide = els.length - 1;
//new code:
			opts.startingSlide = els.length - 1;
		else 
			startingSlideSpecified = true;
	}
	else if (opts.backwards)
		opts.startingSlide = els.length - 1;
	else
// change this: opts.startingSlide = 0; to this opts.startingSlide = els.length - 1;
//new code:
		opts.startingSlide = els.length - 1;

HOWEVER - when I do this the slideshow loads the first slide then jumps to the new starting slide instead of just starting on the specified starting slide. I know that this "fix" is not the best way to do this but have not found another way yet.

Anyone have any other ideas???

andyanderso’s picture

Title: One possible way to do this? » How to use a variable to define the startingSlide option?

changing title to make issue easier to find

NickDickinsonWilde’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

if you have json2.js you can set advanced options in the slideshow settings including starting slide # (it has a 0 based index).