Jump to content
Search Community

Two draggable synchronized elements and inertia property

inteltone test
Moderator Tag

Go to solution Solved by Rodrigo,

Recommended Posts

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

  • Solution

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!

  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...