This is a migrated thread and some comments may be shown as answers.

Kendo UI move draggable on drop

1 Answer 212 Views
Drag and Drop
This is a migrated thread and some comments may be shown as answers.
Mani
Top achievements
Rank 1
Mani asked on 01 Mar 2016, 01:14 PM
Hi there,

I'm working in Rollbase using Kendo UI. I'm currently making a drag  drop with the Kendo UI Drag & Drop functionality. It works well, except I want the draggable element to stay visible when it gets dragged onto the dropTarget. I made that work using offset, but when I zoom the screen in or out, the dropTarget moves while the draggable stays untouched.

Does anybody know a way in which I can make my draggable stick to the dropTarget?

Here's some code:
$(".draggableTire").hover(function(){
    $(".draggableTire").removeClass("dragTire");
    $(this).addClass("dragTire");
    $(".dragTire").kendoDraggable({
        holdToDrag:true,
        hold:function(e){
            $(".dragTire").css({"border":"1px solid orange","border-radius":"10px"});
        },
        hint:function(e){
            return e.clone();
        },
        dragend:function(e){
            $(".dragTire").css({"border":"0px","border-radius":"0px"});
        },
        autoScroll:true,
      });
});
 
$("#tireWasteFirst").kendoDropTarget({
    drop:function(e){
        $(e.draggable.element[0]).offset({
            top:e.sender.targetElement.y,
            left:e.sender.targetElement.x
        });
        $("#tireWasteSec").show();
        formActions(e.draggable.element[0].id);
    }
});

1 Answer, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 03 Mar 2016, 09:43 AM
Hello,

the approach should work in general. You may also consider actually moving the DOM element of the draggable into the drop target one.

Regards,
Petyo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Drag and Drop
Asked by
Mani
Top achievements
Rank 1
Answers by
Petyo
Telerik team
Share this question
or