• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Changing the stack order with JavaScript

Explorer ,
Feb 06, 2017 Feb 06, 2017

Copy link to clipboard

Copied

Hi all,

is there any way (JavaScript or whatever) to change the stack order (= z-order) of objects in a Captivate project?

It would be extremely useful to be able to rearrange the stack order without having to create new objects every time. In general, there are different methods in JavaScript for doing so. Has anybody ever successfully employed them on Captivate?

I use Captivate 9 and publish in HTML5. Thanks in advance for any advice!

Views

1.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

People's Champ , Feb 07, 2017 Feb 07, 2017

You can do it if you get the correct element. For example, to move Text_Caption_2 above Text_Caption_1 you need to get the rewrap element of Text_Caption_2:

document.getElementById("re-Text_Caption_2c").style.zIndex=2000;

Finding the correct element may be an issue, for Text_Caption_2 there are 3:

document.getElementById("Text_Caption_2c").style.zIndex=2000;

document.getElementById("Text_Caption_2").style.zIndex=2000;

document.getElementById("re-Text_Caption_2c").style.zIndex=2000;

Only one of them wi

...

Votes

Translate

Translate
People's Champ ,
Feb 06, 2017 Feb 06, 2017

Copy link to clipboard

Copied

I'm fairly certain that it's not possible.

The zIndex is in the CPM.js, you would need to change the zIndex before thee element is rendered in the DOM. You can change it but the page would need to be refreshed.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 06, 2017 Feb 06, 2017

Copy link to clipboard

Copied

Ok, thank you for the answer. That´s a pity. This would be a really useful tool.

So if somebody has a great idea how it could be done - please let me know!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 06, 2017 Feb 06, 2017

Copy link to clipboard

Copied

Michael,

What would be the benefit of rearranging the stack order INSTEAD of using different objects?

I'm not sure I understand your use case.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 06, 2017 Feb 06, 2017

Copy link to clipboard

Copied

Assume we have two objects (object1 and object2) where object1 is on the "top layer". At some point we want to have object2 at the top layer. Then we need to create a third element (which is equal to object2) which is in the stack order on top of object1.

This is not so bad if we have only two objects und both object are Smartshapes, for example. However the situation gets much worse

- if the objects are not Smartshapes but web objects. Each object has to be loaded separately which can consume a lot of time and memory resources (depending on the kind of web object).

- if we do not have only two objects but for example ten objects which can be arranged in different z-orders. There are 10! = 10*9*8*...*2*1 = 3.628.800 different possible orders. Maybe the order shall depend on some variable - this would never be possible if you have to create each order separately with different objects.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 06, 2017 Feb 06, 2017

Copy link to clipboard

Copied

OK.  I think I get your drift. I've never really encountered this requirement in any content I've had to develop, but your mileage may differ.

I guess this would be a good thing to suggest as an enhancement request for some type of Advanced Action that would take the object by name and move it up or down in the stacking order by a given number of layers.

Feel free to log it with Adobe.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 06, 2017 Feb 06, 2017

Copy link to clipboard

Copied

Yes, I think I'm going to suggest it as an enhancement request!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Feb 07, 2017 Feb 07, 2017

Copy link to clipboard

Copied

You can do it if you get the correct element. For example, to move Text_Caption_2 above Text_Caption_1 you need to get the rewrap element of Text_Caption_2:

document.getElementById("re-Text_Caption_2c").style.zIndex=2000;

Finding the correct element may be an issue, for Text_Caption_2 there are 3:

document.getElementById("Text_Caption_2c").style.zIndex=2000;

document.getElementById("Text_Caption_2").style.zIndex=2000;

document.getElementById("re-Text_Caption_2c").style.zIndex=2000;

Only one of them will actually change the zIndiex.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 07, 2017 Feb 07, 2017

Copy link to clipboard

Copied

LATEST

Wow, that's cool! Thank you very much! I tried it out - it really worked!

I'm going to experiment a little bit with this - when I'm lucky it's already enough for my purposes!

So thank you again!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Help resources