Go to the end of slide

Hello
I try to go to the end of the slide (end of the main timeline) when pressing a button or if one detects the mute mode is pressed. I did not find a javascript instruction to do this. I tried this statement when loading the slide: if (prez.muted ()) {
prez.slideTime (18268);
}
but the display of the page is very long.
Thank you for helping me.

Hi,

You must also check if the slide is at the end, otherwise infinite recursion will occur:

var slideEndTime = 18268;
if (prez.muted() && prez.slideTime() < slideEndTime) {
    prez.slideTime(slideEndTime);
}

Regards

Hello,
thank you for your reply,
It works well if I add code to each slide by adjusting the slide duration variable.
I tried to create an event with the following code:
if (prez.muted () && prez.slideTime () <slideEndTime) {
prez.slideTime (slideEndTime);
}
On each slide I add an action to the load to adjust the slideEndTime variable and call the event.
It does not work anymore.

image

Hi,

Variables in a Execute JavaScript action are different from variables defined in the editor.
If you want to use a variable defined in the editor, please change your code to:

var slideEndTime = prez.variable('slideEndTime');
if (prez.muted() && prez.slideTime() < slideEndTime) {
    prez.slideTime(slideEndTime);
}

Regards