Thomas Günther Posted June 7, 2022 Posted June 7, 2022 Heya ? I noticed I can not limit an Observer to type: pointer. It will always trigger, also on mobile/touch devices. While I can use a condition like e.event.type.includes('pointer') I'm wondering if this is a bug. In this codepen I listen to onLeft and onRight but I don't want this on mobile devices. It will scroll, jump back and then animate the scroll. See the Pen qBxMVmB by medienbaecker (@medienbaecker) on CodePen.
Solution GreenSock Posted June 8, 2022 Solution Posted June 8, 2022 Great catch, @Thomas Günther. Sorry about the confusion there. That's fixed in the next release, but for now it should be as simple as wrapping your .observe() in this: if (ScrollTrigger.isTouch !== 1) { // <- skip if it's a touch-only device ScrollTrigger.observe({ type: "pointer", ... }); } 1
Thomas Günther Posted June 8, 2022 Author Posted June 8, 2022 Thanks for the quick answer, @GreenSock! I'm glad you could fix it ? In the meantime the isTouch is also a much better solution than my event type condition, thanks!
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