0
votes

I am successfully dragging objects but these objects after they are cloned into new area do not preserve mouse events that were attached to them before they were dragged and dropped.

instance.find('.gt-playlist-content').find("div[class*=gt_draggable]:not(.ui-draggable)").draggable({
        connectToSortable: ".gt_sortable",
        helper: "clone",
        revert: "invalid",
        start: function (event, ui) {
            var _item = jQuery(ui.helper); 

        }
    });


jQuery("#main .gt-playlist-content").droppable({
        tolerance: "touch",
        drop: function(event, ui) {
           //console.log(jQuery(ui.draggable));

       }
    }); 

Is there a way to clone events like you would do with jQuery?

$(elem).clone(true);

edit:

actually I found my answer here how to clone a helper jquery-ui-draggable-helper-function-for-clonetrue-true-only-clones-once

although this clone plugin instance data which I dont want.

1

1 Answers

0
votes

Give a class the dragging elements. And,

$('body').on('click','.theClass',function(){

    //Your codes
});

this click event would work for dynamically added elements.