I'm using the jqueryUI to create functionality basically very similar
to the iGoogle drag and drop. I've got a number of boxes that i'm
dragging around. Basically, I've got it working so that I can drag
one and drop it on another element. Then, it will reposition itself
after that element in DOM order, and all the elements are floated.
Very simple to accomplish, and it works great. However, when I've
dropped it, i need to reset its relative positioning back to 0. I've
also accomplished this. The problem is that I would like to make it
more dynamic, by repositioning while dragging, so that you can see
what is about to happen. I accomplish this, but am unable to reset
the relative positioning of the draggable from the droppable's over()
function. Here is my code:
$("div.Draggable").draggable({ // this works to reposition it after
it has finished.
stop: function(e,ui) {
ui.instance.element.css("left","0px");
ui.instance.element.css("top","0px");
}
});
$("div.Draggable").droppable({ //none of these approaches seem to work
for me
accept: "div.Draggable",
over: function(e,ui) {
$(this).after($(ui.draggable));
ui.draggable.css("left","0px");
ui.draggable.css("top","0px");
ui.helper.css("left","0px");
ui.helper.css("top","0px");
ui.position.left = "0";
ui.position.top = "0";
}
});
thanks for any help!