Jump to content


remove draggable div from parent div

Moderator Tag

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



The code :


I'm working on project with draggable and works perfect, BUT

i cant get one thing working. After you drag a div over a grid of divs 

the draggable div is append to the cell from the grid. 

This works fine.


But when you drag the div for the second time, the div has to be 

'de'-preppend (works) only its on the wrong position.


I guess its the transform that needs to be reset. But what ever i try 

i cant get the result i want.


There must be a simple sollution somehow, but after 2 hours of try and error i ask...


Thanks for the great software and the support !


gr Mels

See the Pen WQGqLB by hemels (@hemels) on CodePen

Link to comment
Share on other sites

Hello hemels, and Welcome to the GreenSock Forum!


I tried looking at your example but all i see is a grid with no element to drag.

Link to comment
Share on other sites

not sure what the end result is supposed to be, but you might doing things out of order. And I wouldn't use top or left with a Draggable element that uses x and y.


Here's a quick fix...

See the Pen yYVLKm by osublake (@osublake) on CodePen


And here's a drag and drop example that switches between containers...

See the Pen waVYvz by osublake (@osublake) on CodePen


Also, you might want to look through mine and Diaco's CodePen demos as we have a lot Draggable examples.



  • Like 4
Link to comment
Share on other sites

Jonathan, are you on small monitor or do you use CodePen with the panels on top? It should be about one grid square below the entire grid.

  • Like 1
Link to comment
Share on other sites

Yep that was it Blake.. :idea:   I was to lazy to view on my desktop. I was viewing on my laptop in codepen, but panels were to the side. I had to hit F11 to go fullscreen then i saw the blue box. I forgot to switch my profile to compact.  :blink:  But Thanks Blake  :D

  • Like 1
Link to comment
Share on other sites

You moderators (ALL) are such fine coders but above all so very nice and helpful folks. What a great experience it is visiting this forum (almost every day)!

  • Like 2
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.