Jump to content
Search Community

Section disappears when top reaches top. ScrollTrigger, .pin

DaCodeWiz test
Moderator Tag

Recommended Posts

I'm working on a project currently with Vite. I'm using scrollTrigger on a component so that it animates a scale on a video in the background while also animating in some text in the foreground. I originally used Gatsby with the project and was able to set the #root { position: fixed; } in my index.scss but now that i'm Vite I can't do that otherwise i'm unable to scroll altogether. I don't know think it's worth the time of completely recreating three sections in codePen to achieve the same effect but I will post screenshots with the code since i'm fairly certain it's just a positioning issue with my css. 

This is the Reel.jsx

code1.thumb.png.1b469397d1d087d747d26f21ab1ff5b8.png

Below is the index.scss

 code2Medium.png.c500f515c918586c3073be17a4376afa.png

Below this is the Reel.scss

code3Medium.png.8f756b77dd98f27e6d84998a39b8e514.png

If the images and everything are too much, I understand and feel free to remove the post. Otherwise, any help is super appreciated since this has been buggy for hours now.

Link to comment
Share on other sites

It's pretty tough to troubleshoot without a minimal demo - the issue could be caused by CSS, markup, a third party library, your browser, an external script that's totally unrelated to GSAP, etc. Would you please provide a very simple CodePen or CodeSandbox that demonstrates the issue? 

 

Please don't include your whole project. Just some colored <div> elements and the GSAP code is best (avoid frameworks if possible). See if you can recreate the issue with as few dependancies as possible. If not, incrementally add code bit by bit until it breaks. Usually people solve their own issues during this process! If not, then at least we have a reduced test case which greatly increases your chances of getting a relevant answer.

 

Here's a starter CodePen that loads all the plugins. Just click "fork" at the bottom right and make your minimal demo

See the Pen aYYOdN by GreenSock (@GreenSock) on CodePen

 

If you're using something like React/Next/Vue/Nuxt or some other framework, you may find StackBlitz easier to use. We have a series of collections with different templates for you to get started on these different frameworks: React/Next/Vue/Nuxt.

 

Once we see an isolated demo, we'll do our best to jump in and help with your GSAP-specific questions. 

Link to comment
Share on other sites

Hi @DaCodeWiz welcome to the forum!

 

I can't read half the code you posted, because the text is too small. Creating a Codepen demo isn't that difficult, just copy the GSAP code and create some coloured divs for the elements you're animating. Taking a step back from you setup and first trying out things without all the baggage of Vite React is a great way to get off the ground, on Codepen you can just try 20 things and see what sticks. And you'll find that you'll solve 90% of your own bugs by making it simple. 

 

Also if you're working in React be sure to use the gsap.context() 

 

  • Like 1
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...