Jump to content
Search Community

using pin and each

LSchneiderman test
Moderator Tag

Go to solution Solved by mvaneijgen,

Recommended Posts

I want to pin every element of a certain class when it gets to the center of the screen. I don't want them to pin all at once -- just once each one reaches the center of the screen. I'm trying to use forEach and ScrollTrigger pin. Can someone tell me please what I'm doing wrong?

See the Pen XWyMJwM?editors=1111 by lschneiderman (@lschneiderman) on CodePen

Link to comment
Share on other sites

  • Solution

Hi @LSchneiderman,

 

There is no items in your HTML with the class .subhead, so your javascript code does nothing. It always a good idea to start console.log() some values when debuggen, that way you can see if what you think is happening is really happening. 

 

Changing the class to .story-subhead (which is in your HTML), seems to do the trick. Hope it helps and happy tweening! 

 

See the Pen xxQqgqN?editors=1011 by mvaneijgen (@mvaneijgen) on CodePen

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