sagexiang Posted January 30 Share Posted January 30 When there are regular parts before and after the content of this effect, the browser scroll bar will be confused and the page turning will be abnormal. What is the best way to achieve this situation? The built-in snap effect of GSAP is too slow. I hope to scroll up and down so that when I encounter a page turn, I can turn the page smoothly ~ See the Pen YzyaKrq by GreenSock (@GreenSock) on CodePen Link to comment Share on other sites More sharing options...
Solution mvaneijgen Posted January 30 Solution Share Posted January 30 Have you seen the Observer plugin https://gsap.com/docs/v3/Plugins/Observer/ instead of it using the scrollbar it just uses the scroll event itself and does logic based on that. See the Pen XWzRraJ by GreenSock (@GreenSock) on CodePen And here an example that mixes normal scrolling with the Observer plugin See the Pen oNQPLqJ by GreenSock (@GreenSock) on CodePen Hope it helps and happy tweening! Link to comment Share on other sites More sharing options...
Rodrigo Posted January 30 Share Posted January 30 Hi, Also take a look at this demo: See the Pen NWxNEwY by GreenSock (@GreenSock) on CodePen Happy Tweening! Link to comment Share on other sites More sharing options...
sagexiang Posted January 30 Author Share Posted January 30 10 hours ago, mvaneijgen said: 您是否见过观察者插件 https://gsap.com/docs/v3/Plugins/Observer/而不是使用滚动条,它只使用滚动事件本身并基于此执行逻辑。 这是一个将普通滚动与观察者插件 混合在一起的示例 希望它有帮助,祝补间快乐! I can see gsap.registerPlugin(ScrollTrigger) & gsap.registerPlugin(Observer)~ What is the relationship between Observer() and ScrollTrigger.observe()? Thank you~! Link to comment Share on other sites More sharing options...
GreenSock Posted January 30 Share Posted January 30 ScrollTrigger.observe() is just a way to create an Observer instance. It's identical functionally. Since Observer is used by ScrollTrigger, it's already inside that file, so we did that as a convenience so that if you're already using ScrollTrigger, you wouldn't need to load the Observer file separately. 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