Jump to content
GreenSock

scavaliere

Pinned layered divs with smooth ScrollTo

Go to solution Solved by Shaun Gorneau,

Recommended Posts

Hello! 
I would like to know if it's possible to have a smoothscroll effect on layered pinned divs. 
In my codepen seems not to work, when I click on link it jumps without scrolling in a smooth way. 
I'm using ScrollTrigger and ScrollTo plugins.


Thank you in advance!

See the Pen KKaEmvJ by scavaliere (@scavaliere) on CodePen

Link to comment
Share on other sites

  • Solution

Hi @scavaliere,

 

Two quick things.

  1. You can't start an id with a digit, it must start with [A-Za-z]
  2. Before scrollTo can do its thing in response to clicking on an anchor, you must first prevent the default behavior (which is to jump to the position of an element with a matching name or id)

See the Pen BapbRXv by sgorneau (@sgorneau) on CodePen

 

Hope this helps!

 

Shaun

  • Like 4
Link to comment
Share on other sites

Hello Shaun, 
it works perfectly !
Thank you!

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