Thanks for the welcome Benjamin!

A live version of the script can be found on http:// 
<http://www.ethowin.net/dragTest.htm>www.ethowin.net/dragTest.htm 
<http://www.ethowin.net/dragTest.htm> <www.ethowin.net/dragTest.htm>.
I tried using your code, but it neither cloned or removed the dragged 
element.
Also, the problem is quite random and doesn't seem to happen very often 
at all, so perhaps I could iterate through all lists on each drag/drop, 
and delete any found duplicates. But that might lead to some unnecessary 
overhead when the number or items grows.

/ Fredrik

Benjamin Sterling skrev:
> Fredrik,
> Welcome to the list!
>
> Not sure what you mean by "qhetto" solution, but your way seems fine.
>
> Is there a live version I can look at?  No exactly sure what you are 
> doing with $('body').mouseover and then what $(this) is reffering to.
>
> But, doing something like (untested):
>
>  $(dragged).clone().remove().appendTo('#' + groupID + ' ul').wrap('<li 
> class="character"></li>');
>
> The above should:  clone dragged, remove drapped, append cloned to 
> 'groupID' and wrap cloned in the li item.
>
> Let me know if that worked and if you can show me a live version.
>
>
>
>
> -- 
> Benjamin Sterling
> http://www.KenzoMedia.com
> http://www.KenzoHosting.com
>
> On 7/7/07, *Fredrik Karlsson* <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>
>     I just found this group yesterday, and I've already found a lot of
>     good advice from reading old posts. But I couldn't find a solution to
>     some weird behaviour I'm having.
>
>     I am using jquery together with Interface to play around a bit with
>     drag&drop + ajax. So a basic test was to move an element between two
>     lists. The code I've come up with looks like this:
>
>     $(document).ready(function(){
>                     $('body').mouseover(function(event){
>                             if ($(event.target).is('li')){
>                                     $(event.target).Draggable({revert:
>     true, fx: 300, ghosting: true,
>     opacity: 0.4});
>                             }
>                     });
>
>                     $('.group, #charter').Droppable(
>                             {
>                                     accept :                'character',
>                                     activeclass:    'activeGroup',
>                                     hoverclass:             'hoverGroup',
>                                     tolerance:              'pointer',
>                                     onDrop:                
>     addCharToGroup
>                             }
>                     );
>
>             });
>
>             var addCharToGroup = function(dragged)
>             {
>                     var groupID = $(this).attr('id');
>                     var charName = $(dragged).html();
>
>                     $('#' + groupID + ' ul').append('<li
>     class="character">' + charName
>     + '</li>');
>                     $(dragged).remove();
>             }
>
>
>     I'm not sure if binding the mouseover event to add ".Draggable" to new
>     list items is a "ghetto" solution, but it seems to be working fine.
>     My problem is that every now and then, the item I move will duplicate
>     itself. Is there any other way I should be removing the original item
>     after moving it?
>
>     / Fredrik
>
>
>
>
> -- 
> Benjamin Sterling
> http://www.KenzoMedia.com
> http://www.KenzoHosting.com 

Reply via email to