How to use javascript to auto-scroll a scroll panel
Aug 21, 2015
Hello,
I found one discussion that relates to this topic, but there was no real solution to this issue.
I have a button "BTN1" on Layer1. When I click BTN1, I show Layer 2. On Layer2 I have a scroll panel with some content (images/text) in it. I also have a trigger on this scroll panel > Execute Javascript when timeline starts. The javascript is:
window.scroll(0, 150);
When I publish the content and run it in a browser on my PC, the contents of the scrolling panel DO NOT automatically scroll when I display Layer2.
- Is my js correct?
- Is my "Execute Javascript" trigger attached to the right object (e.g. the scrolling panel)?
- If I were to use a web object on Layer2 instead of a scrolling panel, how can I trigger "Execute Javascript" when there is no way to reference the web Object on that layer?
10 Replies
You can't connect any objects created in SL with code using JS. I recomend use to that flash - then you're able to show users scrollpane with content in needed place
You actually can use javascript and link it to a custom object in Storyline via triggers, such as custom buttons. You can't do autoscroll though, which is what I think this thread is about. You are right that many of us requested this feature a long time ago and it was added to the feature request pile and never heard from again.
Thanks David and Kamil for chiming in here.
I have been trying this as well. I have one slide with a scrolling panel, when you click on an object it goes to the second slide where I have it execute the same JS.
I'm wondering after looking through the code if window is the right item? (i.e. is it window.scrollTo or something else?)
I tried a few others and it hasn't worked. If anyone has other ideas please let me know.
Try this:
Yukon Training Blog
http://www.thearticulatetrainer.com/is-there-a-way-to-make-a-scrolling-panel-automatically-scroll/
Thanks Walt for sharing that here.
Give this code a try in your web object.
Hi Walt - Thank you that seemed to work if I only had one item in the scroll bar, but once there are more it gets a bit complicated.
Seth do you know where I put that code exactly? In the story.html file?
In your web object index.html file.
Glad you are getting the assistance needed here Avni :)
This discussion is closed. You can start a new discussion or contact Articulate Support.