Jump to content
Search Community

ScrollToPlugin issue

cotyhsu test
Moderator Tag

Go to solution Solved by cotyhsu,

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hi everybody,

 

So I'm playing around the latest GSAP SrollToPlugin and trying to recreate this sample published on the site:

 

The issue I occurred is when I click on the navigation, the content will jump back to the top first then do the scroll, I found if I use the <button> instead of <li> then it works just fine. Does anyone knows what cause this issue? Thanks in advance.

 

 

Here's the code:

 

https://jsfiddle.net/cotyhsu/6rrdt6kw/3/

 

 

See the Pen LkOrKY by GreenSock (@GreenSock) on CodePen

Link to comment
Share on other sites

That's not a bug - it's just that you set your <a> links to have an href of "#" which basically means "jump to the top of the current page". So it's obeying your instructions :)

 

To get the effect you want, you could just make your href="javascript:" which essentially does nothing. 

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