September 28, 2018
Using javascript to jump to last slide in project (not based off of slide index or name)
Comments
(2)
September 28, 2018
Using javascript to jump to last slide in project (not based off of slide index or name)
Newbie 5 posts
Followers: 0 people
(2)

Hi there, I’m wondering if anyone knows a way to use javascript to jump to the last slide of the project if you don’t know the amount of slides in the project? Obviously I can look at how long the project is everytime and put in the slide index number like –

window.cpCmndGotoSlide = 15;

but I’m wondering if there isn’t some way to identify the last slide of the project, so that if the number of slides changes I don’t have to go back and change my code?

Any help is much appreciated.

Thanks.

2 Comments
2018-09-29 23:29:46
2018-09-29 23:29:46
Like
2018-09-29 13:10:39
2018-09-29 13:10:39

The slide numbers are zero indexed.  That means if you have 10 slides – your last slide is slide number 9.   So – using the cpInfoSlideCount variable we can subtract 1 from that.   I used this on a button and it worked.

window.cpCmndGotoSlide = (cpInfoSlideCount-1);

It should always track the total number of slides and by subtracting 1 bring you to the end.

Like
(2)
Add Comment