Skip to main content
Known Participant
November 2, 2018
Answered

Java script to hide figure and jump to specific slide

  • November 2, 2018
  • 7 replies
  • 516 views

Hey everyone!

I have a mind map, with approximately 20 options (little squares). I would like to create an interactive file, where I can click on each option (square) and open a slide with a fact sheet for this option. Then, in each fact sheet, I would like to have two buttons: a yes and no. If yes, then I should be redirected to the initial mind map with no alterations. If no, then I am redirected to the initial map, but the map no longer has the square that I clicked in. This means that I would like to hide the figure (which is in another slide) and be redirected to this slide, where the figure no longer is available. The process would restart and continue until all the little squares were evaluated.

To do so, I thought that I could do a button with the option to execute a JavaScript. In this script, I would like to have to the options to jump to a certain slide and hide the figure X - and keep it hidden for the rest of my presentation. The goal is that the user can assess all the 20 options, by reading their fact sheets, and deciding if they should be kept in the mind map. In this sense, each person would be able to develop their individual mind map.

Does anybody know if this is possible and how could I write this code?

I am not very familiar with programming and this is was the 'best' option I found so far. I am also open to new ideas

Thank you!

This topic is closed to new replies. Start a new post to keep the conversation going.
Correct answer TLCMediaDesign

You don't really need JavaScript for this. JS would work if you named everything correctly and you could make the code dynamic so all slides used the same code.

For example, if the square you click on was named "map_1_cb" and the slide you jump to for the description was name "map_1", you could execute:

cp.hide(window.cpInfoCurrentSlideLabel+"_cb");

window.cpCmndGotoSlide = 1; //slide number - 1

window.cpCmndResume = 1;

Or you could just create an action:

On the no button, just hide the square and jump back to the slide in a shared action.

7 replies

Known Participant
November 12, 2018

Hi! Sorry for my late response! The shared action worked perfectly and indeed was much easier. Thank you very much for the help.

Lilybiri
Legend
November 12, 2018

Of ccourse shared actions are much more powerful than mot think. Have a look at:

Challenges for Starters - Captivate blog

TLCMediaDesign
TLCMediaDesignCorrect answer
Inspiring
November 2, 2018

You don't really need JavaScript for this. JS would work if you named everything correctly and you could make the code dynamic so all slides used the same code.

For example, if the square you click on was named "map_1_cb" and the slide you jump to for the description was name "map_1", you could execute:

cp.hide(window.cpInfoCurrentSlideLabel+"_cb");

window.cpCmndGotoSlide = 1; //slide number - 1

window.cpCmndResume = 1;

Or you could just create an action:

On the no button, just hide the square and jump back to the slide in a shared action.

Lilybiri
Legend
November 2, 2018

Why not use a shared action?

TLCMediaDesign
Inspiring
November 2, 2018

Agree Lieve, that's what I said in the last 2 lines of my post.

The JS would only be beneficial if it was running in the background in an external file and listening for button clicks.

If not, you would need to execute JS just as many times as a shared action.