Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
cotyhsu

ScrollToPlugin issue

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

Ah that's right... thanks for the help!

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