Flip through title animation whenever you hit a set number of pixels, animation won't work

So I have 4 titles.
First title for example becomes Opacity 100 > 0 and also moves from 0 to -20px after scroling to 600px.
Second Title, which actually sits 20px lower, then comes in at 600px and goes from Opacity 0 > 100 and moves in from 0 > -20px as well, then at 1200px, it’ll go back to Opacity 0 and moves from -20px to -40px,
Third title works similarly to second, however my issue is that when I scroll to 1200px, the Second Title won’t disappear so the Third title just sits behind it and it looks ugly. It actually starts to fade out and move closer to 2000px instead, and it also moves diagonally, not upwards.
Any clues as to why this is happening? Is this a glitch?