How to connect action with javascript?
December 7, 2015 12:00 AM
Hello, how can I attach an action to javascript in Lectora?
For example I would like a user to click on each step in accordion before showing next img or button. Or when they check out a carousel to have an img popping out for each step.
Help...:)
undefined
Discussion (5)
I'm not sure I understand what you are looking to do. Can you provide a sample of what you are working on and explain how you want it to function? Variables can be passed back and forth between JavaScript and Lectora.
You can add an action to an item and then request that it run a javascript code. Is that what you mean?

1. Create a variable in Lectora, e.g. "allsectionsseen"
2. Create an action group on Page 1 with one action
Action: Show
Target: Arrow_next
Condition: Only if
"allsectionsseen" contains "#accordion-1" AND
"allsectionsseen" contains "#accordion-2" AND
"allsectionsseen" contains "#accordion-3"
3. Edit "Externe HTML-Objekte Code"
Under the line "var currentAttrValue = jQuery(this).attr('href');"
add two lines of code:
Varallsectionsseen.set(Varallsectionsseen.getValue()+currentAttrValue);
runGroup_og99();
Replace og99 with the html name of the action group created under 2.
Tim
I attached the sample of what I'm working on...
I have the accordion and an img below, and I want img to be seen only after the user clicked on all fields in the accordion.
undefined
ahhhhhh....
that's it...great!!! thank you!!! <3!!
Discussions have been disabled for this post