Skip to main content
Dirlo
Inspiring
March 20, 2023
Question

Javascript - Hide many objects

  • March 20, 2023
  • 1 reply
  • 377 views

...

Hello Captivaters !...

I'm working on a big project (around 50 slides)...

On each slide, I have a next button which I wanted to be invisible when I entered (or re-entered) the slides...

I wanted to create only one action for all the entering action slide...

So I used :

hide nxt_button_01

hide nxt_button_02

hide nxt_button_03

And so on until :

hide nxt_button_50

 

So I was wondering if there would be a simple Javascript which could easily hide all these buttons !...

Thanks in advance !...

😉

...

    This topic has been closed for replies.

    1 reply

    Dirlo
    DirloAuthor
    Inspiring
    March 20, 2023

    I answer myself as I just found this :

    https://community.adobe.com/t5/captivate-discussions/how-can-we-show-hide-or-enable-disable-captivate-objects-using-javascript/td-p/7391737

    So I think I have to rename the 01 in 1, 02 in 2...

    And use :

    for ( var i=0; I < 50; i++ )

    {

    parent.cp.hide("nxt_button_"+I)

    }

    But I also read in this post that there is a problem with the < symbol in an advanced action ???...

    I will make more inquiries... and will come back soon !...

    😉

    Lilybiri
    Legend
    March 20, 2023

    Do you really need an instance of the next button on each slide? If this is a non-responsive project, why not use a Next button which is timed for the rest of the project? It will have always the same instance name.

    If you really need a JS, know that this is also possible with the CpExtra widget by InfoSemantics. I am lazy and prefer to use that widget.

    Dirlo
    DirloAuthor
    Inspiring
    March 20, 2023

    Thanks for your answer Lily !...

    I rarely use the "timed for the rest of the project" option as I often use different "types" of slides... But I'm sure your solution could help !...

    Fortunately the javascript I wrote above seems to do the job !!!...

    (You will be glad to see this project as my aim is to locate all the african countries on a map !... And I know you are an african lover !... As I am !!!...)

    😉