pro2html Posted December 27, 2020 Share Posted December 27, 2020 I have one page scroll functionality. On scroll page jumps to top from random position. Sorry I'm without codepen right now. Maybe have you quick answer and you met this problem before? The link https://emelya.studio/storage/frame/ I'm scrolling with this code: function goToSection(panel, anim) { gsap.to(window, { scrollTo: {y: panel, autoKill: false}, duration: 2, overwrite: "auto", onComplete: () => { enableScroll(); } }); } gsap.utils.toArray(".map-slide-trigger").forEach((panel, i) => { ScrollTrigger.create({ trigger: panel, onEnter: () => goToSection(panel) }); ScrollTrigger.create({ trigger: panel, start: "bottom bottom", onEnterBack: () => goToSection(panel) }); }); Link to comment Share on other sites More sharing options...
ZachSaucier Posted December 28, 2020 Share Posted December 28, 2020 Hey pro2html and welcome to the GreenSock forums. A few notes: Your webpage gives a 404. Please create a minimal demo when seeking debugging help in these forums. The demo where you got this approach from is an exploration as to what is possible. I don't recommend using this sort of approach in production because webpages are not meant to be restricted in this way. If you are going to try and restrict scrolling in this way, I recommend using a more full solution like FullPage.js because it's specialized in this sort of thing. However even then it's not perfect. You can use GSAP along with FullPage.js. Happy tweening! 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