jQuery用户界面可排序 - 获得该项目进行排序 [英] Jquery UI Sortable - Get the item being sorted

查看:104
本文介绍了jQuery用户界面可排序 - 获得该项目进行排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用jQuery用户界面可排序(其中的方式是伟大的),你如何获得当前正在排序的项目。

当您使用 $(本); 它返回实际的排序列表,而不是当前排序项

我想要做的花式裤子事情,当用户拖拽它的小部件。例如。两个列表之间拖动时动画吧。

那么,如何获得当前项目进行排序?

有下面一点点code来解释一下...

  $(函数(){
    $(#sortable_1)。可排序({
        启动:函数(事件,UI){
            //获取当前元素进行排序
        },
        停止:函数(事件,UI){
            //获取当前元素进行排序
        }
    })disableSelection()。
});


解决方案

至于我在知道 UI 你的启动:功能(事件,UI)是要排序的当前元素。

由于在评论中指出 ui.item 是当前元素。

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 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.

这篇关于jQuery用户界面可排序 - 获得该项目进行排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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