Forum Discussion
MathNotermans-9
5 years agoCommunity Member
Javascript to trigger multiple elements in Storyline
A user needed a sample of a Javascript to trigger an audio on all elements on a slide. Offcourse that is possible so i made a sample.
https://360.articulate.com/review/content/a477f9f5-6348-4570-8...
larryvanwave-ff
3 years agoCommunity Member
Another follow up question, is there a way to use "this" as in place of the actual variable name in the gsap function? Just so I could refer to the function without having to use the name of the variable, this way I can reused the code, (see example below).
var player = GetPlayer();
var TopButtons = document.querySelectorAll("[data-acc-text='ImmEnroll']");
var TranButton =document.querySelectorAll("[data-acc-text='Transport']");
TranButton.forEach( item => {
item.addEventListener('mouseup', MouseUpHandler )
});
TopButtons.forEach( item => {
item.addEventListener('mouseup', MouseUpHandler )
});
function MouseUpHandler( event ) {
gsap.to(this, {duration:.5, alpha:.5})
}