jQuery UI : Combining Selectable with Draggable

前端 未结 2 1235
粉色の甜心
粉色の甜心 2021-01-16 05:59

I\'m having a big problem trying to get my head round how the selectable() and draggable() components of jqueryUI can work together.

<
相关标签:
2条回答
  • 2021-01-16 06:41

    You could have just use mousedown event to manually make the items selected.

    var mouseDownCallback = function(e) {
    
        if (e.ctrlKey==0) $('#your-container').children().removeClass('ui-selected');
    
        $(this).addClass('ui-selected');
    
    }
    $('#your-container').on('mousedown','.item', mouseDownCallback);
    
    0 讨论(0)
  • 2021-01-16 06:47

    Decided to scrap the selectable plugin and build a basic version myself. The two don't seem to get on very well. I have based my own selectable solution on live() clicks so that it doesn't conflict with the draggable click events.

    0 讨论(0)
提交回复
热议问题