Hey folks,
I'm currently stuck on an implementation detail with the scrollTrigger.
What I want to do:
1. Text size decreases when scrolling down, and increases when scrolling up.
2. Text size start and end values depend on viewport width (mobile, tablet ( from 768px), desktop (from 1440px))
3. Text size (initial and end size) gets recalculated and refreshed when viewport size changes and goes from one viewport zone into another (for ex. desktop -> tablet)
What I have:
1. Works
2. Works
3. Does not work. I tried to implement this functionality with a combination of
- { fontSize: () => initialFontSize }
- invalidateOnRefresh: true
- window.addEventListener("resize", function () { ... ScrollTrigger.refresh(); });
I've tried various versions of this combination but did not succeed. I am grateful for any hints :)
I tried to simplify it and put it in a codepen (attached).
Tobi