1

I am trying to hide and show objects inside Captivate using Captivate JavaScript window, but even though it feels like it should be very easy to do, I cannot get my objects to show!

So far I've tried the following:

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

var CC = $("#CC_text_" + slideNum);      // to get a proper object name as I have similar objects on every page

after that I tried standard JS approaches like CC.hide(); tried changing visibility, etc, but nothing works. Has anyone tried anything like this before?

Thank you!

anton980
  • 41
  • 1
  • 9

5 Answers5

2

I ran into this issue just today as luck would have it. The issue is that $("#CC_text_" + slideNum); returns the accessibility object that is on top of you the object you want. The actual object is a canvas element underneath the accessibility object, and conveniently has the same id + "c". So you'll want:

$("#CC_text_" + slideNum + "c");

Additionally, it appears that objects that are hidden from output (failure captions etc) are set to display: block; visibility: hidden; so .show() won't work, you'll need to use .css('visibility', 'visible')

Mark Smith
  • 104
  • 1
  • 5
0

Please refer to https://helpx.adobe.com/captivate/using/common-js-interface.html

It clearly says:

To hide any object, use cp.hide("object_name");

To show any object, use cp.show("object_name");

0

You may use the "starts with" option of JQuery:

 $(['id^="CC_text_"']);
alabusa
  • 44
  • 4
-1

To show/hide any object via javascript that is contained in the project (i.e., you've entered it via the actions window), I always use:

cp.hide('myText'); // obviously substitute show with hide function
Liam
  • 27,717
  • 28
  • 128
  • 190
user172586
  • 49
  • 7
-1

Just found this. Objects on a master slide e.g. navigation can be accessed with cp.show("objectname"); / cp.hide("objectname"); though I have seen some weird behaviour with the play bar buttons (they will hide but not show once hidden).

agould
  • 9
  • 4