Jump to content
Search Community

End scrolltrigger if condition is false

hello21 test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

Pinning is not conditional as ScrollTrigger has do a lot of calculations and layout changes to make it work. You could always kill your ScrollTrigger, but that would probably mess things up. If you need to wait for something to finish, it might be better to disable scrolling, like by setting overflow to hidden on the body or prevent scroll events.

 

  • Like 1
Link to comment
Share on other sites

Blake is correct about not being able to just call some function to force things to become unpinned prematurely, but it sure sounds to me like you just need to configure your ScrollTrigger properly so that its "end" value is at the right spot. It's very difficult to offer advice, though, without seeing a minimal demo

 

My guess is you can simply have a timeline that animates your slides and then when that timeline is done, it'll automatically unpin. It really should be relatively straightforward unless I'm misunderstanding. A minimal demo will go a long way to getting you a solid answer :)

 

Good luck with your project!

Link to comment
Share on other sites

  • Solution

Oh! I didn't realize you're trying to integrate a 3rd party jQuery tool like slick with ScrollTrigger. That's an entirely different question, so I'm glad you provided the minimal demo

 

I personally would use GSAP for that entire effect, but if I had to use slick, here's how I'd do it: 

See the Pen MWEzNLL?editors=1010 by GreenSock (@GreenSock) on CodePen

 

Normally we can't really help with 3rd party tools like that, but I did this as a courtesy for you :)

 

Is that what you're looking for? 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

That couldn't work logically unless you literally scroll-jack and prevent the user from even being able to move their scrollbar (which would be terrible UX). Imagine if someone drags the scrollbar quickly all the way down the page - what would you expect to happen? How could they get to the next slide now? Things are mapped to the scroll position, but what you're proposing would decouple it from the scroll position. See what I mean? You'd be leaving users stranded. 

 

You could, of course, just listen for mouse wheel events instead, and touchmove/pointermove but that means it'll no longer have anything to do with the scroll position. 

 

You can certainly do whatever you want. Unfortunately these forums aren't intended to be "build-to-order" where you tell us what you want and we build it for you for free (please read the forum guidelines), but if you have any GSAP-specific questions we'd be happy to answer those. 

 

Good luck!

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