inteltone Posted October 10, 2023 Share Posted October 10, 2023 Hi! I am working on a project in which there are two elements: carousel and slider. They are draggable. While dragging any of them their synchronization is ok. But after turning on the inertia property a problem arises. Their synchronization is not that good any more. How to fix that? Thanks in advance for your help! See the Pen vYvbZvM?editors=0010 by inteltone (@inteltone) on CodePen Link to comment Share on other sites More sharing options...
Solution Rodrigo Posted October 10, 2023 Solution Share Posted October 10, 2023 Hi, You were missing the onThrowUpdate callback to run the same logic you already have in your onDrag callback: onThrowUpdate : Function - A function that should be called each time the InertiaPlugin tween updates/renders (basically on each “tick” of the engine while the tween is active). This only applies to the tween that gets generated after the user releases their mouse/touch - the function is not called while the user is dragging the element (that’s what onDrag is for). By default, the scope of the onThrowUpdate is the Draggable instance itself, but you may define an callbackScope if you prefer, just like any other tween. Here is a fork of your codepen: See the Pen gOZqNXE by GreenSock (@GreenSock) on CodePen Hopefully this helps. Happy Tweening! 1 Link to comment Share on other sites More sharing options...
inteltone Posted October 11, 2023 Author Share Posted October 11, 2023 6 hours ago, Rodrigo said: You were missing the onThrowUpdate callback to run the same logic you already have in your onDrag callback Rodrigo, thanks a lot for your quick response! It is exactly what I looked for. Your help is priceless! 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