Trigger JavaScript when click on the Menu items

Feb 12, 2018

Hi All,

I want to trigger a JavaScript function whenever the user clicks on the menu items. And also need to get that page number. Is it possible? Please advice.

Thanks,

Guru

5 Replies
Walt Hamilton

If you are talking about clicking on the slide name in the built-in menu, your best bet is to run the script when the slide timeline begins.

If you don't want to run the script every time the slide is opened, try something like this:

Create a variable (like RunScript). When you click on a button someplace that will take you to the slide, but you don't want the script to run, change RunScript to false before you make the jump. When you arrive at the slide, the first trigger is Run script on condition RunScript is true. Second trigger is Change variable RunScript to true. That way, the script will run if you come from the menu, but not if you come from a button.

Raja Guru

Hi Carlene and Walt,

Thank you for your reply and valuable logics.

The actual scenario is, I have a canvas and a iFrame behind it in a .html page. In that canvas I let the user to draw lines as a marker and store that data. In the iFrame, I loaded Articulate output (story_html5.html). For ex, if a user draw lines in page 3, I need to bring it back whenever he come to that page. This is only possible if I get the page number whenever the user navigate the pages by clicking the next/prev buttons or from the Articulate inbuilt menu. 

I can set the variables and trigger as mentioned in that linked articles. But, it would be nice if I can get the page number dynamically whenever navigate happens. Because, manually place the triggers for each and every slides would be little hard for 'n' number of slides and also if I add or remove slides in between. That will give re work to change all the page numbers manually.

Is there any way to get the page number dynamically when click on the next/prev buttons as well as click on the inbuilt menu?

Thanks,
Guru

This discussion is closed. You can start a new discussion or contact Articulate Support.