Jump to content
Search Community

Trigger on element with parallax

ferriss test
Moderator Tag

Go to solution Solved by ferriss,

Recommended Posts

Hi,

 

I couldn't find if there is something in the docs for this, but I have an element that has a basic transform parallax on it. That same element has a basic toggle class on it when it hits the top of the viewport, however, the makers on the this latter animation are wrong as it takes it from before the parallax.

 

I guess I need to offset it with the transform? But is this performant as the trigger point is constantly changing?

 

The two animations.

 

gsap.to(".js-pick-me-up", {
  ease: 'none',
  scrollTrigger: {
    trigger: ".block-intro",
    scrub: true,
    start: "top top",
    end: window.innerHeight,
  },
  y: window.innerHeight / 2
});

and

ScrollTrigger.create({
  trigger: ".js-pick-me-up",
  end: "bottom bottom",
  start: "top top",
  toggleClass: 'is-fixed'
});

Thanks

Link to comment
Share on other sites

  • 2 weeks later...

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