Forum Discussion
JessicaHinckley
8 years agoCommunity Member
Scrolling panel with trigger
Hi all, I have a project with a scrolling panel on one of the slides, and I want the next button to be hidden until they are done scrolling. Is there any triggers/variables that can make it possible...
SnorreRubin-bd9
Community Member
This code tells you something of how far has been scrolled (in storyline 360 export, anyway):
document.getElementsByClassName('scrollarea-btn')[0].style.top
Note that it will never be 100%, as it gives you as the max is the height of the scroll panel minus the height of the button.
EDIT:
You can calculate how far you have scrolled thus:
var rawPos = Number(document.getElementsByClassName('scrollarea-btn')[0].style.top.replace('%',''));
var btnHeight = Number(document.getElementsByClassName('scrollarea-btn')[0].style.height.replace('px',''));
var panelHeight = Number(document.getElementsByClassName('scrollarea-scrollbar')[0].style.height.replace('px',''));
var scrollPos = Math.round(rawPos*panelHeight/(panelHeight-btnHeight));
console.log(scrollPos)
This will give you an integer of scroll position, in percentage.
GavinElliott-89
5 years agoCommunity Member
Hey Snorre,
Thanks for taking the time to reply to my post with a solution. Before you edited the post, I was about to reply suggesting that perhaps there's a way to calculate the distance. You read my mind!
I'll be sure to give this a go in a future project.
Articulate should really build this in as a trigger.
Kind regards