2

I need some help.

I am using the angular-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.

jsFiddle Demo Here

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();
  });
}
Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Rodrigo
  • 21
  • 2
  • Please add the code you used. If the code is too big to post, try to reduce it to a minimal example: http://stackoverflow.com/help/mcve – Jolta Sep 27 '16 at 15:27
  • 2
    this is an example, but that only works clicking on the item needed to do work when dragged. http://jsfiddle.net/vf6dnwxj/11/ – Rodrigo Sep 27 '16 at 19:12
  • I just [answered this for a similar question](https://stackoverflow.com/questions/59337061/dragula-how-to-always-move-an-item-to-end-of-list#answer-59340712) before seeing this one. Three years late to the game, but here is a working example anyway: http://jsfiddle.net/t6pbf8j5/ – Constantin Groß Dec 15 '19 at 02:18

0 Answers0