bevacqua / dragula

:ok_hand: Drag and drop so simple it hurts
https://bevacqua.github.io/dragula/
MIT License
21.89k stars 1.97k forks source link

how to catch a drop event ? #580

Closed ahmedcastres closed 3 years ago

ahmedcastres commented 5 years ago

Hi, I'm trying to catch the event when an object is already dragged in another container. So, when I drag an objet, the function is called hundreds of times. But how can I catch this event once the object is dragged successfully ? Thank you :)

leonardors95 commented 5 years ago

Example if your dragula bag name is "first-bag":

$scope.$on('first-bag.drop', function (e, el) { console.log("DROP EVENT !"); });

mostafaebrahimi commented 5 years ago

if you use drag event across all dragging time your function will be called.so if you need to call your function once ( eg. when item dropped to target) you must use drop event.

drake.on('drop',function(el,target,source,sibling){
    //call your function here
})