Register for our next webinar, 5 Keys to Unlock Storytelling in Your eLearning, where you'll learn how to unlock the magic of storytelling in your eLearning development to increase learner engagement and retention! Join Andrew Townsend, our Campaign Marketing Manager, on Thursday, December 3, 2020 at 11:00 AM MDT.

Be The First On Your Block to Rock Lectora® 21!


Apply for exclusive early access to the latest version of Lectora® Desktop v21. Seating is limited so make sure you apply now!

How to connect action with javascript?

mkiamkia 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

  • klaatuklaatu 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.
  • jvalley4735jvalley4735 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?
  • mkiamkia 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.

     

     

     
  • timktimk Community Member Posts: 1,126
    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
  • mkiamkia 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!

Be The First On Your Block to Rock Lectora® 21!


Apply for exclusive early access to the latest version of Lectora® Desktop v21. Seating is limited so make sure you apply now!