Jump to content
Search Community

I can't run the scrollTo plugin when the page loads. It only works when I add events to the buttons.

cagkebabi
Moderator Tag

Go to solution Solved by Rodrigo,

Recommended Posts

Posted

Hello, what I want to do is to perform a scrollto operation according to a certain condition when the page is loaded, but I can only run the scrollto plugin when I add a click event listener to an element, for example. I have stated the part where I am having trouble with the codepen example with a comment line, thank you in advance for your help.

See the Pen OJKpbLx by CagKebabi (@CagKebabi) on CodePen.

Posted

If I just use scrollTo everything works as expect! Probably your scroll plugin is trowing a wrench in the mix and that is beyond the scope on this forum. 

 

Highly encourage you to use our own scroll smoother plugin aptly named ScrollSmoother https://gsap.com/docs/v3/Plugins/ScrollSmoother/ which works out of the box with all the GSAP tools! Hope it helps and happy tweening! 

 

See the Pen mdNWOxX?editors=0010 by mvaneijgen (@mvaneijgen) on CodePen.

  • Solution
Posted

Hi,

 

You're using Locomotive's scrollTo method, that is a part of Locomotive's API, not our API so for obvious reasons we can't really offer support it.

 

We have the ScrollTo Plugin as well as the ScrollSmoother Plugin (which also has a ScrollTo method as well):

 

https://gsap.com/docs/v3/Plugins/ScrollSmoother/

 

https://gsap.com/docs/v3/Plugins/ScrollToPlugin

 

Hopefully this helps

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