Reputation: 4760
I would like the vertical scrollbar to be displayed when I call element.scrollTop = <somePosition>;
Here is an example of what I'm trying to achieve: https://plnkr.co/edit/0ls05cCa3XrvrWPO?open=lib%2Fscript.js&preview
If that example is loaded on iOS, when the left box is scrolled, the right box should sync with it. That works just fine, but I need a way for the scrollbar to also show up.
Upvotes: 1
Views: 837
Reputation: 529
I think your issue is that division being scrolled via Javascript is not recognized as active
, to keep scrollbar visible.
I would suggest to try any custom Scrollbar
library, they manage scrollbars with divisions rather than browser's.
Many such would allow you to configure scrollbar to be shown and hidden using Javascript.
It would add additional work for you, but it can be a solution to go with.
Here are few you can try with: https://www.jqueryscript.net/blog/Best-Custom-Scroll-Bar-jQuery-Plugins.html
Upvotes: 2
Reputation: 453
You could dynamically add a css class to the container when performing scrollTop()
.
Try a class that implements overflow-y: scroll
when applied. That should yield the desired effect.
Upvotes: 1