Jump to content
Search Community

Pinned div shifts on scroll

FedMash test
Moderator Tag

Recommended Posts

I have an issue with a pinned div containing svg that shifts on the start of the scroll. I recreated the demo version, but it is more visible in the original version.

I have read the docs and all other posts on the topic I could find and tried 

pinType: "fixed"

But it didnt solve the issue for me. 

 

Thank you in advance!

 

 

 

 

scroll_gsap.gif

See the Pen Exgwyax by fedmaria (@fedmaria) on CodePen

Link to comment
Share on other sites

HI! Thank you for replying! I`ve updated my post with a gif. Basically, when the "start" meets the "scroll-start" pinned element jumpes or shiftes just slightly. Also, in the dev tools, I can see that the width of the div is recalculated, but not sure why.  

It is the same on Chrome and Firefox.

Screenshot 2020-12-22 at 20.04.31.png

Link to comment
Share on other sites

This is due to the fact that browsers handle scrolling in a separate thread. Because of this fact and the fact that browsers don't update the main JS thread often enough, some jump like this is inevitable. With that being said, you can experiment with ScrollTrigger's anticipatePin property to limit the amount of jump to get it to as least as possible.

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...