开发者

Jquery UI Sortable - Get the item being sorted

开发者 https://www.devze.com 2022-12-30 08:29 出处:网络
When using Jquery UI Sortable (which is great by the way) how do you get the item that is currently being sorted.

When using Jquery UI Sortable (which is great by the way) how do you get the item that is currently being sorted.

When you use $(this); it return the actual sortable list, not the current sorted item.

I want to do fancy-pants things with the widget when the开发者_StackOverflow中文版 user is dragging it around. E.g. Animate it when dragging between two lists.

So how do I get the current item being sorted?

There a little code below just to explain a little more...

$(function() {
    $("#sortable_1").sortable({
        start : function(event, ui){ 
            //get current element being sorted
        },
        stop : function(event, ui){ 
            //get current element being sorted
        }
    }).disableSelection();
});


As far as I'm aware ui in your start: function(event, ui) is the current element being sorted.

As pointed out in the comments ui.item is the current element.

0

精彩评论

暂无评论...
验证码 换一张
取 消