Jump to content
Search Community

ScrollTrigger element positioning issue on window resize

Lovestoned test
Moderator Tag

Recommended Posts

Hey Lovestoned.

 

This is really just a CSS question. I highly recommend that you spend some time learning the basics of how to position things with CSS in different ways. 

 

A few notes:

  • It almost never makes sense to absolutely position the body element.
  • Not setting all of the transforms of elements that you're animating with GSAP is one of the most common GSAP mistakes.
  • You're using some of the old syntax in that you're including the duration in the second parameter. We recommend including it in the vars instead so that you can make use of GSAP's defaults.
  • You should do your best to try and stick to animating performant properties

 

If I were doing this sort of thing, I likely wouldn't use absolute positioning at all but use one of the many other methods of centering the text.

Link to comment
Share on other sites

Hi Zach

 

Sorry but I cannot find solution. I tried different ways to center my .text element vertically. Removed transform property from element and changed .panel element display to flex, justify-contents:center, align-items:center...but I couldnt animate it to top:120px

 

when I comment out tl.to .text it is centering my absolute element in .panel but when I apply tl.to not centering on resize...

 

I want to make my .text element vertically centered in .panel and on scroll animate it to top:120px...so please help me to make it...ok I understand it is css issue but I need your experience...

 

is it a problem about to refresh on resize?as you see it is working but when resize not centering itself vertically...

 

 

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