LSchneiderman Posted June 27, 2023 Share Posted June 27, 2023 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 More sharing options...
Solution mvaneijgen Posted June 28, 2023 Solution Share Posted June 28, 2023 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 3 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now