Huy Nguyen 2K Posted July 3, 2023 Share Posted July 3, 2023 Hi, I follow this example to handle scroll to snap section in my website but I want on mobile it can scroll as normal in some section and also keep preventDefault: true to prevent scroll behavior of the browser. Is anyway to resolve this problem? Thank you! See the Pen XWzRraJ by GreenSock (@GreenSock) on CodePen Link to comment Share on other sites More sharing options...
mvaneijgen Posted July 3, 2023 Share Posted July 3, 2023 If you want to control what gets loaded on what screen size, check out GSAP matchMedia() https://greensock.com/docs/v3/GSAP/gsap.matchMedia() And here is a pen that disables the observer when some conditions are met and then goes over in normal scrolling behaviour. Hope it helps and happy tweening! See the Pen oNdNLxL by GreenSock (@GreenSock) on CodePen 2 Link to comment Share on other sites More sharing options...
Huy Nguyen 2K Posted July 4, 2023 Author Share Posted July 4, 2023 14 hours ago, mvaneijgen said: If you want to control what gets loaded on what screen size, check out GSAP matchMedia() https://greensock.com/docs/v3/GSAP/gsap.matchMedia() And here is a pen that disables the observer when some conditions are met and then goes over in normal scrolling behaviour. Hope it helps and happy tweening! But in my case, I can't disable observer because it's cause some problem. Is anyway to handle scroll on mobile with observer. Thanks! Link to comment Share on other sites More sharing options...
mvaneijgen Posted July 4, 2023 Share Posted July 4, 2023 What have you tried already? We love to see minimal demo's, that way we can see your thought process and thus better help you. 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