Jump to content
Search Community

scrollTo next element

paketaaa test
Moderator Tag

Recommended Posts

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. 

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