Jump to content
Search Community

ScrollTrigger - if pinned ?

TELLO test
Moderator Tag

Recommended Posts

Hi all,

 

how can I get in other function if the ST navi_second is pinned or not?

 

ST

gsap.to(navi, {
  scrollTrigger: {
    trigger: navi_second,
    endTrigger: "",
    end: () => "+=" +
      $(document).height(),
    pin: true,
    pinSpacing: false,
    onEnter: () => tl_navi_mini_ani.play(),
    onLeaveBack: () => tl_navi_mini_ani.reverse()
  }
})

 

Here I need if pinned or not:

$(navi_second).on("mouseenter", function () {
  console.log(navi_second.ispinned_or_not)
});

 

THX for help

TELLO

Link to comment
Share on other sites

1 minute ago, TELLO said:

How can I add this additional to my line, where I have my function already?

 


onEnter: () => tl_navi_mini_ani.play(), myvar = true, 

You have a few options.

 

You could either use a more conventional function like so:

onEnter: function() {
  tl_navi_mini_ani.play();
  myvar = true;
}

Or do the same sort of thing with your inline function:

onEnter: () => {
  tl_navi_mini_ani.play();
  myvar = true;
}

Or technically you use &&, though this is error prone because values could be falsy and it doesn't look good:

onEnter: () => tl_navi_mini_ani.play() && myvar = true,

 

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