Explore the community Forums Lectora Lectora Questions & Answers How to connect action with javascript?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #302568 Score: 0
    Profile photo of Mkia
    Mkia
    Member
    beginner
    intermediate
    friend finder
    contributor
    wise owl
    advanced
    curious george
    3 pts
    @Mkia

    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…:)

     

    #302596 Score: 0
    Profile photo of Darrel Somoza
    Darrel Somoza
    Member
    contributor
    friend finder
    beginner
    intermediate
    junior moderator
    advanced
    wise owl
    curious george
    profile
    199 pts
    @Klaatu

    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.

    #302605 Score: 0
    Profile photo of Jennifer Valley
    Jennifer Valley
    Member
    contributor
    beginner
    friend finder
    advanced
    lectora beginner
    verified member
    wise owl
    profile
    picture perfect
    curious george
    114 pts
    @jvalley4735

    You can add an action to an item and then request that it run a javascript code.  Is that what you mean?

    Attachments:
    #302627 Score: 0
    Profile photo of Mkia
    Mkia
    Member
    beginner
    intermediate
    friend finder
    contributor
    wise owl
    advanced
    curious george
    3 pts
    @Mkia

    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.

     

     

     

    • This reply was modified 3 years, 8 months ago by Profile photo of Mkia Mkia .
    Attachments:
    1. Accordion.zip
    #302630 Score: 3
    Profile photo of Tim K
    Tim K
    Member
    contributor
    beginner
    intermediate
    advanced
    friend finder
    junior moderator
    advocate
    wise owl
    curious george
    Group Member
    303 pts
    @timk

    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

    This post has received 3 votes up.
    #302632 Score: 1
    Profile photo of Mkia
    Mkia
    Member
    beginner
    intermediate
    friend finder
    contributor
    wise owl
    advanced
    curious george
    3 pts
    @Mkia

    ahhhhhh….

    that’s it…great!!! thank you!!! <3!!

    This post has received 1 vote up.
Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.