Scroll into view interaction issue

Hello guys!

So, I am working on this scroll into view interaction. Although the interaction works as it is supposed to when I scroll down but it acts weirdly when I scroll back up. I tried changing things and offset but still, it is causing issues. It would be great if I could get some help from you guys.

Thank you
Regards,
Sagar Arora


Here is my public share link: https://preview.webflow.com/preview/knowledge-units?utm_medium=preview_link&utm_source=designer&utm_content=knowledge-units&preview=cb2ccd4b431e7c218b5545e8193a63c4&pageId=5fcf9099d57893098c3ce511&mode=preview