Navigating slides in JS

Problem: Is it possible to navigate to slides in Javascript on the basis of the name of the slide.

E.G. I’m in slide ‘Living Room’ and have two arrows. One leads to the slide ‘kitchen’, the other to the slide ‘bathroom’.

I would like to name the arrows ‘Nav-kitchen’ and ‘Nav-bedroom’.

I would then like to use JS on the click-event of the navigations-arrows where the name of the slide I want to go to is retrieved through this.name.substring(5).

As far as I can see this, i.e. navigating to a slide on the basis of the slide’s name through JS, is not possible. Just wanted to make sure, though. Is there a workaround? Slide-Index would not be helpful for me…

Thanks,

Rolf

ActivePresenter version: 9

OS: Win10

Notes:

Hi Rolf,

You can use prez.showSlide('slide name') function to jump to a slide.
For your convenience, please see this sample: go-to-named-slide.approj (224 KB)

However, in the current version, slide name has HTML format so this function may not work with some special names. In future releases, we’ll separate the name for scripting and the name for displaying (or the title - HTML formatted) to overcome this issue.

Regards

Thanks, Toan,

perfect, as always.

Just to be on the safe side: You talk of ‘special names’. What might that be? So far, everything works fine. Slide names are in alphanumerical characters plus underscores, e.g. “Sem_Wc_desk_1”. No ampersands or stuff like that …

Thanks,

Rolf

Hi Rolf,

ActivePresenter will try to convert HTML formated slide names to plain texts to compare with the slide name passed to prez.showSlide function.
In fact, we don’t see any issue with this conversion so far (even if slide names contain characters like ampersands…). So I think it’s safe in your case.

Regards

1 Like