Jump to content
Search Community

Pushed content below the panels causes jank

xoxoxoxo test
Moderator Tag

Recommended Posts

I have a div that I would like to push below the last panel. I'm getting Scrolltrigger's end value and adding that to margin top value.

However, on Safari and Chrome I get a "gap" on scroll between the last panel and the div that's pushed to the bottom.  It almost feels like the last div isn't "catching" up to the panel that's being transformed.

Not sure how to solve this.

See the Pen mdPZzGG by nullhoooook (@nullhoooook) on CodePen

Link to comment
Share on other sites

Basically i'm trying to have a div which would follow the last panel (purple) as the normal flow.
If I don't add an explicit position then the div sits on top as my container is position absolute. Also this div can be of any height.

If I don't explicitly position it then this is how it would look: 

See the Pen jOrEbVJ?editors=0010 by nullhoooook (@nullhoooook) on CodePen

Link to comment
Share on other sites

I can't pin it because I want the div to scroll normally following the last panel. If you look at my initial codepen you can see how this works.

Is there no way to achieve this without explicitly positioning the div as per my initial example?

Link to comment
Share on other sites

@ZachSaucier I've created the issue I was having here: 

See the Pen XWKJRbP?editors=1000 by nullhoooook (@nullhoooook) on CodePen



Look at the last image panel which has a gif and then look at the div that follows, you can see it's laggy and it takes time to "catch up" with the last panel.

If you still can't see it I can attach you a video. It's even worse on Safari.

Link to comment
Share on other sites

.to(panel, { yPercent: -100 });

The above moves the content based on the total height of the last section.

end: () => `+=${panels.length * 2 * 100}%`

The above moves the content based solely on the viewport height.

 

You need to change the end value to use the actual height of at least the last section since you're increasing it. Exactly how you should change it depends on the way you want it to feel.

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...