tags:

views:

33

answers:

1

Hi All,

I have a page which has a table with lots of rows and columns. I'm dragging and dropping an element in one of the table cells. Once dropped I want to reposition the element inside the cell properly so that it is aligned with the table contents (like placed in the corner of the cell, or if other elements are present, then place it below those elements etc). I'm finding it difficult to reposition it.

I'm using to reposition

ui.helper.animate({top: '0px', left:'0px'},500);

but this tries to position the element relative to the position I started dragging. I got the cell coordinates like this

$(this).position().top;
$(this).position().left;

and the draggable position like this

ui.position.top;
ui.position.left;

Any idea, how can make this work. Thanks.

Ravi

A: 

Are you using jQuery UI Sortable?

fudgey
No, I'm using Droppable ( http://jqueryui.com/demos/droppable/#revert).
Ravi