Share Posted November 11, 2021 I have added jquery smooth scroll to next section from top to Scroll Down link. The scrolltrigger animation doesnt work properly. Could anyone please help me with this issues. Thank you See the Pen WNEgeKW by murugans02 (@murugans02) on CodePen Link to comment Share on other sites More sharing options...
Share Posted November 11, 2021 Welcome to the forums, @Murugan S. jQuery Smooth Scroll and smooth-scrollbar are not GreenSock products, so we can't really support them here but the problem in your demo is that you're using jQuery Smooth Scroll to animate the "real" scroll position of the page, but you're using smooth-scrollbar to do scroll-jacking (fake scroll), and wiring that to ScrollTrigger so they're not synchronized at all. In other words, jQuery Smooth Scroll is scrolling the WRONG thing. Plus I think your offset that you're calculating is likely incorrect as well because again, it's based on positioning of the "real" scroll whereas you're doing fake-scroll stuff. I would strongly recommend NOT using jQuery, much less jQuery Smooth Scroll. If your goal is to animate the scroll position, you can use GSAP's ScrollToPlugin, sorta like: gsap.to(bodyScrollBar, {scrollTop: "+=" + $("#animatedsection").offset().top, duration: 1}); Good luck! 1 1 Link to comment Share on other sites More sharing options...
Author Share Posted November 12, 2021 Awesome!. Thank you So much it works fine Link to comment Share on other sites More sharing options...
Author Share Posted November 12, 2021 Hi All, I need an help on the above, I need to add class to the body when the last section comes in viewport. Could you please help me on this. Thank you Link to comment Share on other sites More sharing options...
Solution Solution Share Posted November 13, 2021 Based on the logic I see in your code... ScrollTrigger.create({ trigger: ".purple", start: () => "top -" + (window.innerHeight*(images.length-0.5)), scroller: ".scroller", onEnter: () => document.body.classList.add("your-class"), onLeaveBack: () => document.body.classList.remove("your-class") }); 1 Link to comment Share on other sites More sharing options...
Author Share Posted November 15, 2021 Thank You So Much. It really helps a lot 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