I am using scrollTop to get the current scroll position of an inner scroll div .content-inner. From here, I am then adding a translate3d to change the position of another div .header-top to give it an animation effect.
The issue I have is after scroll back up on .content-inner the .header-top position is a bit glitchy and not how it originally positioned.
Depending on the speed I scroll back up too will determine how far the position changes. I suspect it's to do with the double negative values outputting on translate3d if you check the console.
Yes you are correct, the problem was a negative value in the calculation once you have reached the top.
I have made some changes to the code, remove unnecessary overflows, and capture the window scroll event. Also made the header fits nicely inside the container.