JQuery Dragable on button, helper option not working

53 views Asked by At

I want to drag button from one div to other. I'm using helper option "clone" but my original button are now dragging. i want to perform a task in that when dragging stops I want to remove clone object and create different element in the same position...

here is my code for dragable and dropable.. Please tell me what I'm doing wrong!!

btn.draggable({
    helper: 'clone',
    cancel: false,
    appendTo: dropContainer,
    revert: "invalid",
    cursor: 'move'
});
btn.disableSelection();
var top1, left1;
dropContainer.on("mousemove", function (event) {
    top1 = event.pageY - 10;
    left1 = event.pageX - 220;
});
dropContainer.droppable({
    accept: btn,
    drop: function (event, ui) {
        var dropped = ui.draggable;
        $(dropped).detach().css({
            top: top1,
            left: left1
        }).appendTo(dropContainer);
    }
});
0

There are 0 answers