Jump to content
Search Community

How can I get to the scroll position where the pin starts and ends (pin: true) using scrollTrigger?

yeisonvelez11 test
Moderator Tag

Recommended Posts

 

I am somewhat new to this, and I want to know please how can I get the scrollbar position where the pin starts and ends, I need to get this data before firing the scrolltrigger event.

 

this is my live code:

 

    gsap.registerPlugin(ScrollTrigger);
    ScrollTrigger.defaults({
      toggleActions: "restart pause resume none",
      // markers: true,
    });
    let tl = gsap.timeline({
      scrollTrigger: {
        start: "top top",
        end: "200% top",
        trigger: ".container",
        toggleActions: "restart none reverse none",
        markers: true,
        scrub: true,
        pin:true
      },
    });

 

http://plnkr.co/edit/9r2cT9sJV3mqkeDy?open=lib%2Fscript.js

Link to comment
Share on other sites

Hey yeisonvelez11. ScrollTriggers have start and end properties which you can access. You can see them and all of the other properties and methods in the ScrollTrigger docs. You just need a reference to the ScrollTrigger (using an ID or using tl.scrollTrigger) to access these properties. If you need this on page load you might add an event listener for the refresh event: http://plnkr.co/edit/vxGdPg0IVtx52ZFj?open=lib%2Fscript.js

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