How to avoid jumping when scroll to top in a fixed element?

Viewed 32

Check out my codepen showing the problem. The element becomes sticky when it reaches the element.ofssetTop. Everything works fine so far. The problem is when I'm scrolling back to top. I see jumping instead of a smooth transition.

`https://codepen.io/gondziu/pen/poVNWBq`

EDIT: Everything works now, if someone needs the js vanilla affix script check the codepen.

0 Answers
Related