hello21 Posted January 12, 2022 Share Posted January 12, 2022 I am using scrolltrigger to pin one of the mid section of the site to scroll through slick slider slides , is there any way to unpin scrollTrigger when the slider reaches the last slide Link to comment Share on other sites More sharing options...
OSUblake Posted January 12, 2022 Share Posted January 12, 2022 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. 1 Link to comment Share on other sites More sharing options...
GreenSock Posted January 12, 2022 Share Posted January 12, 2022 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 More sharing options...
hello21 Posted January 13, 2022 Author Share Posted January 13, 2022 Hi, Thanks for the reply , here's the link to my codepen: See the Pen wvrQLqa by gaurav501 (@gaurav501) on CodePen i want the slider section to remain pinned till it scrolls through all the slides . currently it unpins the section after scrolling through few slides Link to comment Share on other sites More sharing options...
Solution GreenSock Posted January 13, 2022 Solution Share Posted January 13, 2022 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? 1 1 Link to comment Share on other sites More sharing options...
hello21 Posted January 13, 2022 Author Share Posted January 13, 2022 Thanks a lot for helping. 1 Link to comment Share on other sites More sharing options...
hello21 Posted January 17, 2022 Author Share Posted January 17, 2022 sorry for troubling you guys , currently it scrolls us through all the slides on scroll , can we restrict the scroll to scroll through one slide at a time Link to comment Share on other sites More sharing options...
GreenSock Posted January 17, 2022 Share Posted January 17, 2022 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now