paketaaa Posted June 24, 2022 Share Posted June 24, 2022 Hey Everyone, is there a way to scroll my arches in Codepen right to next element without using id on him? I've tried to make offsetY 100% but I think I'm doing something wrong. See the Pen WNMzeez by paketaaa (@paketaaa) on CodePen Link to comment Share on other sites More sharing options...
mvaneijgen Posted June 24, 2022 Share Posted June 24, 2022 I'm not sure what you are trying to do. You are using two plugins: ScrollTrigger which is a plugin to animate elements on scroll, and scrollTo which is a plugin that allows you to scroll to certain elements on the page without the user having to scroll them selfs. I would recommend checking out the docs on both plugins and see which one suits your problem. https://greensock.com/docs/v3/Plugins/ScrollTrigger https://greensock.com/docs/v3/Plugins/ScrollToPlugin I think you just want to use ScrollTrigger, if that is true check out the ScrollTrigger demo page and find a demo looks like it does what you want. Open it in codepen and take a look how they've done it. Edit: `offsetYPercent` is not a property of scrollTo. You can use `offsetY` and this will add an offset to the element you want to scroll to. Normally when you do something like scrollTo it will scroll to the precise top of the element and if this is some text you want to have some offset to make the text still easily readable. Making this a percent is a bit weird, because of what should it take the percentage? The browser height? The elements height, if so just get the height of those elements with JS and use that as your value. 1 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