Jump to content
Search Community

Scrolltrigger batch add class

late_night1982 test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

Hello,

 

I'm using ScrollTrigger to reveal element on scroll using batch. I would like to add a class inside 'onEnter' parameter. I currently use 'attr' but it erases all my classes. I read I could use classList.add() to do it, but I'm not sure where in the code to place it and how to do it.

 

ScrollTrigger.batch(".js-reveal", {
interval: 0.1,
onEnter: batch => gsap.to(batch, {autoAlpha: 1, stagger: 0.1, attr: { class: "is-visible" }}),

});

 

I use a GSAP pen for example.

 

Thank you.

See the Pen oNmWggR by mathieupreaud (@mathieupreaud) on CodePen

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