Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Jean-Baptiste Janot

Draggable.endDrag() with inertia on

Recommended Posts

Hi everyone,

 

Thanks again for the amazing tools, I am a long term user now and still amazed everyday by the gsap platform ♥️

 

I am trying to completely stop the dragging and tweens of a Draggable instance when clicking on a button in order to move the dragged item programmatically and prevent jumps.

I use the endDrag function, but when the draggable instance is configured to use inertia and snaps, it always complete the snap first no matter what.

How can I be sure that every tween is stopped when using endDrag(), even the inertia related ones?

 

I can create a codepen if it is not clear enough.

 

Thank you for your help.

Link to post
Share on other sites

Well, I found the solution...

You have to use gsap.killTweensOf(target); and that will do the trick.

Here is what it could look like :

draggable.endDrag(event);
gsap.killTweensOf($scroller);
draggable.update();

I can delete the post or just leave it for maybe future reference?

 

Have a nice day everyone.

  • Like 1
Link to post
Share on other sites

I was literally JUST typing that answer, @Jean-Baptiste Janot! You beat me to it by a few seconds. Nice work :)

 

And yes, let's leave the post because it may help someone else who has a similar question in the future. 

 

Thanks for being a Club GreenSock member! 🙌

  • Like 1
Link to post
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.

×