Managed to figure out how to get the ID of the element under my mouse
by using something as simple as:

var targetElemID = "";
$('body').mouseover(function(event){
        if ($(event.target).is('li')){
                targetElemID = $(event.target).attr("id");
        }
});

The remaining problem now would be to swap the two items. I've tried
chaining with clone(), remove(), next() and before() to insert the
elements into the right position, but I'm not getting it right.

$('#' + targetElemID).remove().clone().before('#' + $
(dragged).attr("id"));
$(dragged).remove().clone().before('#' + $('#' +
targetElemID).next).attr("id"));

God that looks messy... help!? =D


On 12 Juli, 19:38, Fredrik Karlsson <[EMAIL PROTECTED]> wrote:
> Currenly I'm working on a project where I'm using a bunch of
> droppables and draggables to organize list items.
> Now there is one thing I can't figure out how to do.
>
> If I have two droppables containing lists with items (<div
> class="droppable"><ul>...</ul></div>), and I want to swap one of the
> items in one droppable with one in another droppable, basically
> swapping to <li> tags, by drag/dropping one on the other. Is there a
> way to get the id of the <li> my mouse is hovering when dropping my
> dragged item?
>
> I have a demo athttp://www.ethowin.net/WoW/raidplanner.php. I'm also
> thinking of rewriting it by using sortables instead.
>
> Any suggestions?

Reply via email to