Skip to main content
Inspiring
July 6, 2015
Answered

Bring image to front in javascript Cap8

  • July 6, 2015
  • 1 reply
  • 1103 views


Hello,

I have three images A, B and C stacked on top of each other.

I have three click boxes, clickA, clickB, clickC on the same slide as the images.

When any of the three click boxes is clicked I need the corresponding image to move to the top of the stack.

Is this possible in javascript inside Captivate 8 ?

The project will be published in HTML5.

Thank you.

Peter.

Cardiff, Wales, UK. Overcast and muggy with a chance of rain.

    This topic has been closed for replies.
    Correct answer Lilybiri

    Group the 3 images, will label the group Gr_Image.

    Each click box now needs an action with two statements (commands):

    • Hide Gr_Image
    • Show ImageA

    Create a shared action, will have two parameters: the first will in this case always be the group Gr_Image, the second will be the image.

    Apply this shared action to each of the click boxes, first parameter is always the group, second the specific image.

    Here are some articles I wrote about shared actions (I'm busy with a cookbook about actions):

    Dare to Share - part 1 - Captivate blog

    Dare to Share - part 2 - Captivate blog

    Parameters in Shared Actions - Captivate 7 vs. 8 - Captivate blog

    Reuse Shared Actions in other Projects - Captivate 7 vs. 8 - Captivate blog

    1 reply

    Gray Susan
    Inspiring
    July 6, 2015

    Why not hide the images and have them appear when the appropriate click box is selected? You can do that within Captivate without messing with JS.

    Lilybiri
    Legend
    July 6, 2015

    Susan, some users simply want to use JS, I have learned not to answer that this is so simple with shared actions! Each user has his preferences, lot do not trust advanced/shared actions although they are converted to JS on runtime.

    Blog after Posterous? - ClickClick - Captivate blog

    Inspiring
    July 6, 2015

    Lilybiri,

    Some users do not want to use JavaScript, but have to consider it as a last resort.

    Some users just can't see how Advanced / Shared actions can be made to work without having to define a variable for each of my images.

    And as I will have a couple of hundred images in the project I really don't want to spend my life defining variables.

    My thought of stacking the images would mean I could just bring the required image to the top, and add or remove images from the stack without having to add and delete various variables.

    If I am barking up the wrong tree please point me in the right direction.

    I only post a question on here when I have tried and tried and tried to find a solution by myself, and I turn to this forum as a last resort, not as an easy way to get other people to do my work.

    Thank you

    Peter