desandro / draggabilly

:point_down: Make that shiz draggable
https://draggabilly.desandro.com
MIT License
3.86k stars 386 forks source link

Two or more sets of draggable items? #219

Closed WillyWilson1 closed 2 years ago

WillyWilson1 commented 2 years ago

Is it possible to have more than one set of draggable items in their own container on the same page?

I have two sets which work fine for dragging, but not when it comes to dragend - which uses the selector '.draggable'.

I am using the draggie.on('dragEnd', function(e,p) to get position, but it does not take any extra variables.

This means that for the second set dragend is called twice - gives the correct values for top and left, but twice. All items have ids, so is there some way that I can use this?

WW

WillyWilson1 commented 2 years ago

Hi,

Me again.

Figured it out - have used

var draggableElems = document.getElementsByClassName(D);

where D is an identifier.

WW