Jump to content
Search Community

Firing events whilst dragging (draggable)

ochalmers test
Moderator Tag

Go to solution Solved by Diaco,

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

I've read through the docs but couldn't find anything relating to this in there. Is it possible for us to trigger functions or other tweens whilst dragging in draggable? For example if you started dragging, the container would tween to an opacity change or the cursor would change whilst you were dragging then change back when you let go. 


I've attached a pen I have that uses draggable if it's any help to work with.



See the Pen OyLEem by olichalmers (@olichalmers) on CodePen

  • Like 1
Link to comment
Share on other sites

  • Solution

In addition to Carl's answer/really useful links , you can do something like one of these :


using onPress/Release :

var  tween= TweenLite.to('#container ',0.2,{opacity:0.5,paused:true});

var draggables = Draggable.create(".box", {

or run a function on Drag :

var DTween=1 , tween=TweenLite.to('#container ',0.2,{opacity:0.5,paused:true});

var draggables = Draggable.create(".box", {
  if(!DTween){return false}; // return false to avoid run on Drag repeatedly

See the Pen bVpZPV by MAW (@MAW) on CodePen

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...