jquery ui draggable z-index问题

时间:2012-07-07 14:23:17

标签: jquery jquery-ui jquery-plugins

下面是我将表格行绑定为可拖动的代码。但是,拖动的项目会显示在拆分器下方(http://methvin.com/splitter/splitter.js)此问题似乎与z-index有关。我尝试了多种方法来设置拖动项目的z-index。然而,这似乎不起作用。鼠标悬停在表上时会触发bindDragAndDrop方法。有人可以指出我可能是什么问题吗?

function bindDragAndDrop(){

    var table = $('TABLE .dataTable');
        table.find('TR TD.columnClass').bind('mousedown', function() {
            table.disableSelection();
        }).bind('mouseup', function() {
            table.enableSelection();
        }).draggable({
         helper: function(event) {
         return $('<div div="dragDiv" class="drag-table-item"><table></table></div>').find('table').append($(event.target).closest('tr').clone())
 .end().insertAfter(table);
            },
            cursorAt: {
                left: -5,
                bottom: 5
            },
            cursor: 'move',
            distance: 10,
            delay: 100,
            scope: 'cart-item',
            revert: 'invalid'
        });         
 }

1 个答案:

答案 0 :(得分:2)

我尝试了多种方式设置zIndex它不起作用。如下所示 appendTo(“body”)解决了这个问题

 return $('<div class="drag-table-item"><table></table></div>').find('table').append($(event.target).closest('tr').clone()).end().insertAfter(table).appendTo("body");         
相关问题