Jump to content
Search Community

ScrollTrigger function() triggers on page load

JorisD test
Moderator Tag

Go to solution Solved by JorisD,

Recommended Posts

The pen is pretty self-explanatory.
I am want to trigger a function when reaching the 2nd section of my page, but for some reason it gets triggered on page load.
But on the same ScrollTrigger, the ToggleClass behaves normally.
What am I missing here?

I am only defining it at first, and then calling it

Thanks a lot in advance!

See the Pen oNZaoap by jorisd (@jorisd) on CodePen

Link to comment
Share on other sites

  • Solution

Okay that was stupid. I was not just defining the function but also calling it straight in the JS, before calling it in ScrollTrigger. Now that's embarrassing, please consider I said 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...