I'm using anime.js
to get a text block to parallax scroll horizontally, relative to the vertical scroll position. At the moment, I'm trying to get the relative scroll completion percentage like so -
var s = $(this).scrollTop(),
horizontal = $('#horizontal'),
d = $(document).height(),
c = $(this).height();
scrollPercent = 100 * (s / (d - c));
Then, I'm trying to set the scrollLeft for the overflowing text div like so
var scrollPos = scrollPercent * ($(document).width() - horizontal.width());
horizontal.scrollLeft = scrollPos
I'm not sure how to proceed with this further. Ideally, I would want to avoid jQuery
as well, since I'm using anime.js
for all the other animations.