Skip to main content
Inspiring
June 9, 2016
Question

Controlling objects' visibility through captivate's JavaScript

  • June 9, 2016
  • 1 reply
  • 251 views

Hello!  It seems like something that should be very easy, but I cant get it, and it's frustrating!  I need to trigger visibility of an object when a button is pressed and I'd like to do it in JavaScript rather than using Actions because this functionality needs to be repeated on multiple pages.

Currently I have the following code:

var slideNum = window.cpAPIInterface.getCurrentSlideIndex();      // to get current slide number

var CC = $("#CC_text_" + slideNum);                                             // to get a proper object name

after this I've tried a number of things to access this objects' visibility, but nothing worked so far. I thought it'd be as easy as CC.show(); or maybe setting visibilityState to "visible".  What am I missing?

    This topic has been closed for replies.

    1 reply

    RodWard
    Community Expert
    Community Expert
    June 10, 2016

    If this is for an HTML5 project I would suggest you investigate using the CpExtra widget and @syntax or #syntax.

    hashSyntax – CpExtra 1.3 New Feature - YouTube

    Captivate Action Extensions | Infosemantics Pty Ltd

    This would allow you to very easily SHOW or HIDE objects on any slide in the project simply by including a key word in the object name.  You don't need to know any JavaScript to pull this off.