Jump to content
Search Community

GSAP not getting the video height!

Kevin_Canvas test
Moderator Tag

Recommended Posts

Hi Support Team,

I have a problem on my page, in a couple of reloads of the page, next element of GSAP (<div class="pin-spacer">) is not calculating the video height above and is being overlapped with the video. I need it always to push the video up and not to be overlapped. 
This is the wrong behaviour:
image.thumb.png.2abfb44bb660230a6c53d79d5fac686b.png
This is how it should always looks like:
image.thumb.png.739df80ec533c7d4beb138c517bff0e2.png
I would really appreciate if anyone will give a feedback asap. Looks like it's a tricky thing that effecting it. The gsap text component below is using "pin: true", if it helps as a hint.
 

Issue is happening only some times and not always

Wish you a great day all!
Best,
Kevin.

Link to comment
Share on other sites

Hi @Kevin_Canvas and welcome to the GSAP Forums!

 

Without a minimal demo, it's very difficult to troubleshoot; the issue could be caused by CSS, markup, a third party library, a 3rd party script, etc. Would you please provide a very simple CodePen or Stackblitz that illustrates the issue? 

 

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

 

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

that loads all the plugins. Just click "fork" at the bottom right and make your minimal demo

 

Using a framework/library like React, Vue, Next, etc.? 

CodePen isn't always ideal for these tools, so here are some Stackblitz starter templates that you can fork and import the gsap-trial NPM package for using any of the bonus plugins: 

 

Please share the StackBlitz link directly to the file in question (where you've put the GSAP code) so we don't need to hunt through all the files. 

 

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 @GSAP Helper,

See the Pen rNRbWQZ by kevinalku (@kevinalku) on CodePen

 here you could find the codepen link on those 2 components. Here this is not reproducible. Something is effecting in the script. Maybe using a couple of times "Register Scroll Trigger" or any other side effect. It's only a wrongly height calculation that is positioning text section component on top and not calculating the video height at all.  

Link to comment
Share on other sites

Hi @Kevin_Canvas welcome to the forum and thanks for being a club member! 

 

Are use sure it is a GSAP issue? If it is not reproducible in Codepen it sounds like an issue some where else, have you tried removing the video and just setting an a block that has the height you want it to have to see if the issue still exist then. I have the feeling the video is being loaded a tick too late and then the page jumps to its final height. You could also add an event listener to the video that watches for it to be loaded fully and then call ScrollTrigger.refresh() to have it recalculate all the start and end values. 

 

Hope it helps and happy tweening! 

Link to comment
Share on other sites

Hi @mvaneijgen,

 

Thanks for quick feedback! 
I have tried in fact using that refresh on Video DOM loaded function, but I got the same issue. I tried in another way now, adding it into a fake trigger event, wrapping with pin-spacer div and the issue looks like is not reproducible anymore.  Let's see if is no any other issue will be appear, otherwise I will come back with another question here maybe.

Best,
Kevin.

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