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.
Hi Guru, Yes you can run javascript on a click event. Perhaps you can upload a demo to show us what you want to do? You may find this post from Matthew Bibby helpful:
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.
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?
5 Replies
Hi Guru, Yes you can run javascript on a click event. Perhaps you can upload a demo to show us what you want to do? You may find this post from Matthew Bibby helpful:
http://matthewbibby.com/jump/
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.
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
SL does not support getting a page number the way you want, or any other way at this time.
Hi Walt,
Thank you very much for your reply. It's really sad to me. Anyway I will try in any other way and also if any found the solution please let me know.
Thanks,
Guru
This discussion is closed. You can start a new discussion or contact Articulate Support.