Jump to content
Search Community

ScrollTrigger automatically scrolling to the first panel

AnthonyK test
Moderator Tag

Recommended Posts

I am using the code from the "Variable height stacked pinning - ScrollTrigger" demo



I have multiple <sections> with the class of "panel" but on load, the page is auto-scrolling to the first panel with the class of "panel". 
I need to see the main navigation and first hero banner on page load. I only want the scroll effect to happen when you scroll to those sections. 
See here: https://thecommsgurus.com.au/testimonials-2/

(Not a Javascript buff - sorry!). What am I doing wrong? 

Apologies for the beginner question. 

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

Link to comment
Share on other sites

Hi @AnthonyK welcome to the forum

 

What have you tried already? We love to see minimal demo's, that way we can see your thought process and thus better help you. 

 

Sorry we can't really debug live websites, there is just no way to modify the code. Try creating a minimal demo of what you're trying to do, this has two benefits. First this allows you to experiment and try out new ideas. By making it simple people usually solve 90% of their own bugs. Second, you have an easy version you can share in which anyone could edit and modify the code.

  • Like 2
Link to comment
Share on other sites

That is because the snap is invoked as soon as the page loads, eg the start markers already touch. I've changed the start marker too be -20px from he bottom. Enabling markers is really help full when debugging ScrollTriggers, so also do that in your project and see where you expect the markers to be and check if that is correct. 

 

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

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