I do not want to use Triggers. Can someone give me an example, not a video, of Javascript code which can be used to select a group of items and hide them?
My main issue is I am not sure how to select objects in Articulate Storyline 2 using Javascript. In JS with HTML, it is quite simple,
element = document.getElementById(id);
What selectors should I use for ID within Articulate Storyline?
Say I have a bunch of objects grouped, Group5, how would I declare Group5 as a variable? And how would I show() or hide() that group?
Objects and object groups (and most SL elements) aren't directly addressable via getElementById. If you're rejecting layers and triggers out right, you're probably looking for a different tool than Storyline that produces DOM element oriented markup.
Okay, if I must use layers, then how can I show and hide a layer using Javascript? What would the command to select the layer and show it be using Javascript?
You can't directly show a layer using javascript. You can create a trigger that shows the layer when a variable changes. With javascript you can change the value of the variable.
The problem with using javascript to replace triggers is that you have to use a trigger to initiate the javascript. So from a development point of view, adding the javascript may be an extra (and unnecessary) step.
Can you give us a better idea of what exactly you want to have happen, and when?
4 Replies
Objects and object groups (and most SL elements) aren't directly addressable via getElementById. If you're rejecting layers and triggers out right, you're probably looking for a different tool than Storyline that produces DOM element oriented markup.
Okay, if I must use layers, then how can I show and hide a layer using Javascript? What would the command to select the layer and show it be using Javascript?
Thank you
You can't directly show a layer using javascript. You can create a trigger that shows the layer when a variable changes. With javascript you can change the value of the variable.
Here is an example for you to look at.
The problem with using javascript to replace triggers is that you have to use a trigger to initiate the javascript. So from a development point of view, adding the javascript may be an extra (and unnecessary) step.
Can you give us a better idea of what exactly you want to have happen, and when?
This discussion is closed. You can start a new discussion or contact Articulate Support.