Is there a way to get the relative position to it's container of a dropped element ?
thanks.
3 Answers, 1 is accepted
0
Iliana Dyankova
Telerik team
answered on 14 Aug 2014, 08:08 AM
Hi Voss,
I am not quite sure what your current implementation is - is it possible to provide a simple dojo example which demonstrates it? This way I would be able to advice you further and provide concrete commendations. Thank you in advance for your cooperation.
Regards,
Iliana Nikolova
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
I can, but I think I just didn't explain the questions properly.
I have a square (container) 400x400 centered on the page.
I have a little square in the container that is draggable.
When I drag then drop the little square inside the container I would like to know it's X/Y coordinates relative to the container and not the entire page.
I guess one way is to calculate the offset from the square, but wanted to check to see if there was a property that would give me this information on DROP.
thanks.
0
Accepted
Iliana Dyankova
Telerik team
answered on 18 Aug 2014, 11:00 AM
Hi Voss,
Thank you for the details. For this requirement I would suggest to attach a handler to the drop event and use the jQuery offset method. As an example:
$("#dropContainer").kendoDropTarget({
//....
drop: function(e) {
//....
console.log(e.draggable.hint.offset());
}
});
Regards,
Iliana Nikolova
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!