Forum Discussion
Scroll Bar start position
That's really cool - thanks. So how could you scroll, say, to the middle?
Chris
I forgot to account for the offset.
To get to the bottom, use:
var x = document.getElementsByClassName("scrollarea-area")[0];
x.scrollTop = x.scrollHeight-x.offsetHeight;
And to get to the Middle use:
var x = document.getElementsByClassName("scrollarea-area")[0];
x.scrollTop = (x.scrollHeight-x.offsetHeight)/2;
- TeoKar5 years agoCommunity Member
Hello Russel, thank you for the effort putting in examplaining javascript to us, noobs :)
I was wondering. Will this be possible if the slider was placed horizontally instead of vertically ?
var x = document.getElementsByClassName("scrollarea-area");
x[0].scrollTop = 0;
var width_Slider1 = x[0].scrollWidth - x[0].offsetWidth;x[0].onscroll = function(){
var player = GetPlayer();
player.SetVar("width_Slider1",x[0].scrollTop);
}; - ATusenius4 years agoCommunity Member
Thanks a lot for the JavaScript Code! Is there a way to make the scroll jump to 2/3 or 3/4th?
- RussellKillips-4 years agoCommunity Member
Hello Antje
For 2/3 use:
var x = document.getElementsByClassName("scrollarea-area")[0];
x.scrollTop = (x.scrollHeight-x.offsetHeight) * 2/3;For 3/4 use:
var x = document.getElementsByClassName("scrollarea-area")[0];
x.scrollTop = (x.scrollHeight-x.offsetHeight) * 3/4;- AgnesAu-3a70b683 years agoCommunity Member
Hi Russell (or anyone else),
I know it's been a little while since this thread was last active, but I was wondering if there's a way to do this for text entry fields as well? The modern player doesn't display a scrollbar, which is a real pain, and I was hoping there would be a JavaScript solution to at least jump to the top, middle, and bottom of a long text entry field. Thank you!