VR Course Contest


Show us your best virtual reality course and win $50 gift card and a winner badge!
CHECK IT OUT

How to connect action with javascript?

mkia
mkia Community Member Posts: 38
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...:)

 

Comments

  • klaatu
    klaatu Community Member Posts: 988
    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.
  • jvalley4735
    jvalley4735 Community Member Posts: 1,357
    You can add an action to an item and then request that it run a javascript code.  Is that what you mean?
  • mkia
    mkia Community Member Posts: 38
    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.

     

     

     
  • timk
    timk Community Member Posts: 1,147 ✶ Headliner ✶
    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
  • mkia
    mkia Community Member Posts: 38
    ahhhhhh....

    that's it...great!!! thank you!!! <3!!
Sign In or Register to comment.

So You Wanna Be An eLearning ROCKSTAR?

We're all fans of eLearning here! Want to become an eLearning ROCKSTAR? Just click on one of the buttons below to start your rocking journey!