Jump to content
Search Community

Second image pin not working

LauraS
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

Posted

I set up two pins that work fine. One pins a container that holds an image, the other pins a container that holds some text. But lower down, I have a second image container. I used the same code to pin it, and yet it doesn't pin. What am I doing wrong, please?

See the Pen OJBJZmm by lschneiderman (@lschneiderman) on CodePen.

Posted

I found out the reason -- I was pinning using a variable "height" to represent the height of the screen for the end property. Somehow, that didn't work. When I used

Quote

end: "+=600" 

...that worked.

  • Solution
Posted

That's just because you were feeding in a number which is interpreted as an absolute scroll number (from the very top). So I think you meant to do this: 

end: () => "+=" + (window.innerHeight * 2)

I'm using a function-based value so that it updates automatically if the viewport resizes. And the "+=" means to interpret it as relative, so that many pixels PAST where the start of that ScrollTrigger is. 

 

Happy tweening!

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