Forum Discussion
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? I am using Storyline 360 if that makes a difference.
Thanks!
Glad you were able to find what you needed here, Eric :)
Thanks for chiming in to share.
- EricBenson-117eCommunity Member
ok. Actually, I was playing around with this and I had a slight problem with it. In order, for the hot spot to be triggered the user has to let go of the scroll bar and move the mouse over the embedded hot spot. Not a big deal, but functionally annoying.
So, I thought. Wouldn't it be better if the trigger point occurred while the user was still holding the scroll bar?
The issue I found was the difficulty of placing a hotspot over a scrolling panel. The hotspot becomes a part of the scrolling panel content.
Solution: Place the hotspot over the scroll bar, not the content, and extending outside the scroll bar.
I'm glad to say. It worked perfectly.
Here is how I am using this technique. To trigger audio layers when the user scrolls to certain points within a fairly long scrolling panel. The next thing I'm going to try is to see if I can get the trigger to temporarily remove the ability to scroll while the audio is playing. If I can get it to work I'll let you know.
- GavinElliott-89Community Member
I know this is an old thread, but hopefully this is helpful to someone. It is possible to detect a mouse 'click' or a 'mousedown' or any other DOM event using Javascript. In the example below I asked the module to listen out for 'mousedown' and if the target was the scrollbar then some variable in Storyline is adjusted.
I'm not sure whether it's possible to detect how far the scrollbar has been scrolled. I'll update this comment if I find a solution.
SEE MY COMMENTS LATER IN THIS THREAD FOR A POSSIBLE SOLUTIONdocument.addEventListener('mousedown', function(e) {
let myClass = e.target.className;
//console.log(myClass);
if (myClass === 'scrollarea-btn') {
var player = GetPlayer();
player.SetVar("monitor_panel_click",true);
}
});- SnorreRubin-bd9Community 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-89Community 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
- billiswitalskiCommunity Member
while this post is a little old, I'm looking to create a scroll panel between multiple slides. Once the learner scrolls to the bottom of the first portion it seamlessly goes to the next slide and so on. and should the user scroll up to view all the previous slides.
Is this possible? Basically a seamless scroll panel that crosses multiple slides. We are attempting storyline to create a form that captures the date and pull data from a LMS.
thanks so much
- JoeShultheis-63Community Member
I too want the same functionality Curt. Hope it happens.
-joe
- DanielChodosCommunity Member
I agree. I would love to have a scroll to the bottom trigger for scrolling panels to ensure an entire document is viewed before allowing a learner to continue.
- AmyBurnette-b91Community Member
I can definitely use this feature too.
- MircoPietsch-b0Community Member
I came across the same issue today and i would love to see a feature that gives me more control over what happens on my slide in regrad to the scrolling panel. Maybe with some sort of variable (Numbers), that indicates how far the scrolling panel has been moved?!? ¯\_(ツ)_/¯
Different layers with an diy-progress-bar do the trick for me now...
- GavinElliott-89Community Member
Hello. Here is a short piece of code I wrote for the scenario in Storyline where you have a scrolling panel and you want to check whether the learner has scrolled all the way to the bottom. There is, oddly, no built in trigger in Storyline for this.
I've tested this and it seems to work well, but I'd appreciate some folks trying out.
1. Add a JavaScript trigger to the slide where you have a scrolling panel and copy the code in
2. Set a variable in Storyline called 'scrollAtBottom' which is set to 'false' as default
3. Change the number in line 'if (posCalc > 80)'. The number is the position of the bottom of the scrollbar button in the course window as a percentage from the top. You'll need to experiment.
4. Set a trigger in Storyline to 'do something' when 'scrollAtBottom' changes to 'true'. (e.g. allow the learner to proceed/make a button active)
var player = GetPlayer();
var scrollbarBtn = document.querySelector('.scrollarea-btn');
var slideContainer = document.querySelector('.slide-container');
var btnPos = 0;
var slideContainerPos = 0;
var posCalc = 0;
var checkScrollbarPosition = function() {
//DETERMINE THE AMOUNT OF WHITESPACE ABOVE THE SLIDE (OFFSET)
var offset = slideContainer.getBoundingClientRect().top;
//GET POSITION OF SCROLLBAR AND SLIDE CONTAINER
btnPos = scrollbarBtn.getBoundingClientRect().bottom - offset;
slideContainerPos = slideContainer.getBoundingClientRect().bottom - offset;
//CALCULATE DISTANCE BETWEEN BOTTOM OF SCROLLBAR AND SLIDE CONTAINER AS PERCENTAGE
posCalc = (btnPos / slideContainerPos) * 100;
//FOR DEBUGGING ONLY IN CONSOLE
//console.log('btn btm pos: ' + pos);
//console.log('slide btm pos: ' + slideContainerPos);
//console.log('pos calc: ' + posCalc);
//IF POSITION OF SCROLLBAR BUTTON IS MORE THAN 80% FROM TOP OF SLIDECONTAINER SET SL VARIABLE TO TRUE
//Adapt 80% as necessary to accomodate where you want the detection to be
if (posCalc > 80) {
player.SetVar('scrollAtBottom', true);
document.removeEventListener('mouseup', checkScrollbarPosition);
}
}
document.addEventListener('mouseup', checkScrollbarPosition);- VadimRozhanskyCommunity Member
Great solution, Simon, and it works for me too. One little note only. If somebody uses mouse wheel for scrolling, mouseup event not fires. For this scenario wheel event will be useful.
document.addEventListener('mouseup', checkScrollbarPosition);
document.addEventListener('wheel', checkScrollbarPosition);
Hello everyone!
We are no longer seeing this bug, Object Intersects Trigger with Object in a Scrolling Panel slide won't load, in our latest version of Storyline 360.
I'd recommend using Storyline 360 (Build 3.61.27106.0) or later.
If you need to reach our Support Team, feel free to reach out in this discussion or privately in a support case.
- JamesMcCarter-dCommunity Member
This bug absolutely still exists. However, I found a work around. Instead of having the object in the scrolling panel intersect with a target outside the scrolling panel (which still stopped the page from rendering), instead, I created the trigger so that the object outside the scrolling panel needed to intersect with a target inside the scrolling panel. However, the only way I could get it to work was to loop an animation to move the object that's outside the scrolling panel on a small line motion path. The path was small enough that it never leaves the object inside the scrolling panel except if the user scrolls off it. Since both are clear objects, the user can't see any of this happening.