Jump to content
Search Community

remove draggable div from parent div

hemels test
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

Hello,

 

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

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.

http://codepen.io/osublake/public/

http://codepen.io/MAW/public/

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