Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Sahil

Getting target element in Draggable

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

Hi,

 

I have multiple elements in a container and I am using draggable to be able to drag them, after spending a lot of time I came to realize that in draggable using 'this' doesn't let you access target element using jQuery or TweenMax. So how can I access the element that is being dragged? I have attached a simple codepen where I am trying to set padding on target element, I tried many different properties but no changes.

 

Thanks

See the Pen jLygod by Sahil89 (@Sahil89) on CodePen

  • Like 1
Link to post
Share on other sites

Try using this.target instead:

TweenMax.set(this.target, {padding: 100});

 

  • Like 4
Link to post
Share on other sites

Hey Payman,

 

Thanks for jumping in and helping out. Awesome.

 

---

 

 

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.

×