JQuery draggable + sortable: weird mouse offset behavior

I have a draggable <li> list that I can drag into another empty <ul> element. If I dragged the first <li> element of the dragged original <ul> everything works fine ...

Problem:

... but when I drag any other <li> in this list, the “helper” moves away from the mouse pointer as soon as I cross the border of the resulting sortable <ul>. More precisely, it moves to the top of the list.

Has anyone seen this and knows a solution? Well, my problem is that I just use jquery, not really deep into it and never used javascript in depth.

More about the problem:

My jQuery code:

$(document).ready(function() {
    $('#roleList > li').draggable({
        connectToSortable: '#roleDrop',
        containment: '#container',
        revert: 'invalid'
    });                   
    $('#roleDrop').sortable({
        cursor: 'move',
        containment: '#container',
        revert: true,
        update: function() {
            var order = $('#roleDrop').sortable('serialize');
            $.ajax({
                type: 'POST',
                url: '".$postUrl."',
                dataType: 'html',
                data: order
            });
        }                          
    });
    $('#roleList').disableSelection();
});

#roleList #roleDrop , #container - .

, .

:

http://drop.io/download/public/dkabw5hlq3yfm0f84yji/7bf91122adc241373a5da13b5bde4b231644c1c5/da142000-ff76-012b-41ee-f10bc9db08a6/5a1bfa70-68f6-012c-6d08-f2025930ce6a/v2/thumbnail_large

<ul> .

http://drop.io/download/public/dkabw5hlq3yfm0f84yji/2fad1d633d38cf593da46c638d1930431ea5fd35/da142000-ff76-012b-41ee-f10bc9db08a6/5c65c4c0-68f6-012c-6601-f12da00d9d47/v2/thumbnail_large

xhtml, .

+5
1

helper: 'clone' .draggable:

$('#roleList > li').draggable({
    helper: 'clone',
    connectToSortable: '#roleDrop',
    containment: '#container',
    revert: 'invalid'
});                   

jQuery, .

( , ), , , , , . #roleList #roleDrop.

+9

All Articles