s4ty Posted December 17, 2020 Share Posted December 17, 2020 Hello, I have the problem that if I reduce the size of an element, a white space is created underneath. I'm not sure what is the best approach to solving this. I tried to adjust the end point, but then it no longer scrolls the correct distance. In the end, the container has the right height for the start values, but not when the content is reduced by the animations. Do you understand what i mean? Can you help me to reduce the space under the text without changing the scrolling behavior? See the Pen abmWKMB by bennet-reimers (@bennet-reimers) on CodePen Link to comment Share on other sites More sharing options...
ZachSaucier Posted December 17, 2020 Share Posted December 17, 2020 Hey s4ty and welcome to the GreenSock forums. Sorry, I don't really understand what white space you're talking about. There are two sources of white space below your pinned element: White space caused by your animation of the height to 30%. White space caused by the pinning. This is necessary in order to prevent later content from going under the pinned content while it's pinned. Perhaps it would be helpful if you showed us your end goal. That way we can instruct you how to get there. 1 Link to comment Share on other sites More sharing options...
s4ty Posted December 17, 2020 Author Share Posted December 17, 2020 The result should look like the first image/text transition here: https://www.marc-o-polo.com/de-de/inspiration/women-spring-summer-20.html#women-spring-summer-20-opener Please open the link on mobile devices or a browser with a maximum width of ~400px. As you can see the next image comes right behind the first image/text transition no white spaces caused by animation or pinning. In my example above there is a lot of space before the second gray container ist reached. Link to comment Share on other sites More sharing options...
ZachSaucier Posted December 17, 2020 Share Posted December 17, 2020 You could do that in two ways: Pin a container of all of the content. Then use an animation/timeline to animate the pieces within as you need them to be animated including their positions. Use an approach similar to this demo (that's listed in our ScrollTrigger demos). It's best to avoid animating less performant properties like width, height, etc. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now