Share Posted December 22, 2022 Hello, I added lightGallery framework to my gsap project, it works fine, but there is a scroll problem. When I turn off the lightbox, it shifts up and down. How can I prevent this? Can you help me? I guess scroll is not locking See the Pen YzjXZQW?authentication_hash=jVkpoNOKZYdA by pen (@pen) on CodePen Link to comment Share on other sites More sharing options...
Share Posted December 22, 2022 Hi, Sorry to hear about the issues you're having but I'm not seeing any shift or jumps when testing that codepen in both chrome and firefox on Ubuntu 20 and 22. Can you be more specific about the OS and browser where you're seeing this behaviour? Finally you're using different versions for the GSAP core (3.10.0) and the plugins (3.11.4). Is worth mentioning that just today GSAP was updated to 3.11.4 which included a few fixes in ScrollTrigger and ScrollSmoother, so you might want to updated those dependencies on your local machine. Let us know if you have more questions. Happy Tweening! 1 Link to comment Share on other sites More sharing options...
Solution Solution Share Posted December 22, 2022 Hello, I can see the issue described, but as Rodrigo mentioned, you will definitely need to update your GSAP version first; and yes, it looks like it is a problem because you can scroll while the gallery is open, and when it closes it will move back to the position it was before opening (or something along those lines). You will need to find the event working best for you, to toggle ScrollSmoother.paused() at the right time, if you want to disable the scroll while the gallery is open. https://greensock.com/docs/v3/Plugins/ScrollSmoother/paused() Here is a link to the events available with lightgallery: https://www.lightgalleryjs.com/docs/events/ Something like this maybe: See the Pen PoBqpeO by akapowl (@akapowl) on CodePen EDIT: Also, if you update the lightGallery version you are using to at least version 2.5.0, apparently an option comes available that lets you prevent the resetting of the scroll-position altogether which would likely make the blocking of the scroll unneccessary to begin with. Maybe something you'd want to consider. https://www.lightgalleryjs.com/docs/settings/#resetScrollPosition Quote resetScrollPosition boolean true Reset to previous scrollPosition when lightGallery is closed By default, lightGallery doesn't hide the scrollbar for a smooth opening transition. If a user changes the scroll position, lightGallery resets it to the previous value Minimum lightGallery version required: V2.5.0 3 Link to comment Share on other sites More sharing options...
Author Share Posted December 22, 2022 @akapowl thank you very much 1 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