Jquery UI Sortable - 获取正在排序的项目 [英] Jquery UI Sortable - Get the item being sorted

查看:19
本文介绍了Jquery UI Sortable - 获取正在排序的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用 Jquery UI Sortable 时(顺便说一句,这很棒)你如何获得当前正在排序的项目.

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

当您使用 $(this); 时,它会返回实际的可排序列表,而不是当前已排序的项目.

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 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();
});

推荐答案

据我所知,您的 start: function(event, ui) 中的 ui 是当前正在排序的元素.

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

正如评论中指出的那样,ui.item 是当前元素.

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

这篇关于Jquery UI Sortable - 获取正在排序的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆