I'm trying to use jQuery UI draggable/droppable plugins.
I have draggable div
that I drag onto target div
. Target div
is also draggable. I can't seem to be able to figure out a way to attached div
s to their target to move them together when I drag target div
.
Any pointers in the right direction would be highly appreciated.
Draggable Div is a kind of element that you can drag anywhere. Here I have created a Draggable profile card.
Limit draggable area using 'containment' option It is simple. All you have to do is, add an option called containment to the draggable() method. The containment option has a value parent.
To make an object draggable set draggable=true on that element. Just about anything can be drag-enabled: images, files, links, files, or any markup on your page.
Is this what you're trying to achieve? http://jsfiddle.net/wfG3L/5/
If you want to add the draggable div, you can just use $(ui.draggable) directly and append it to the target div, that way you don't have to specify the dropped divs in the .stackDrop to be draggable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With