bevacqua / angularjs-dragula

:ok_hand: Drag and drop so simple it hurts
https://bevacqua.github.io/angularjs-dragula
MIT License
509 stars 110 forks source link

dragula - always drag to the list end #90

Open Rdepaula0 opened 7 years ago

Rdepaula0 commented 7 years ago

I need some help.

I am using the dragula.js and needed to set up that when you drag any object to another list, it goes to the end. Even if I drop anywhere he goes to the end of the list.

Does anyone have any idea how can I do this? Already researched in various locations and without any success.

this is an example, but that only works clicking on the item needed to do work when dragged.

[(http://jsfiddle.net/vf6dnwxj/11/)]

drake = dragula([left1, right1]);
drake.on('drop', function(el, target, source, sibling){

});
var leftList = document.querySelector('#left1');
var rightList = document.querySelector('#right1');
var list = document.querySelectorAll('#right1 li, #left1 li');
for (var i = 0; i < list.length; i++) {
  list[i].addEventListener('click', function(){
            drake.start(this);
        if (this.parentNode.id == 'right1') {
        leftList.appendChild(this);
      } else {
        rightList.appendChild(this);
      }
      drake.end();
  });
}