我实现了一个jQuery UI sortable元素。JQuery UI可排序事件参数不能按记录工作
这里是我的代码:
$(function() {
$("#sortable").sortable({
placeholder: "ui-state-highlight",
stop: function(event, ui)
{
alert('pos:' + ui.position);
alert(ui.offset);
}
});
$("#sortable").disableSelection();
});
的排序工作。根据文档的事件中的UI参数将有几个特性(例如ui.position,ui.offset等)
当我提醒这些他们都返回[object Object]
我想找出移动的位置。 (即位置5现在位置3)因此,我可以将新位置保存在数据库中。
关于你的最后一段,我建议你看看[serialize()](http://docs.jquery.com/UI/API/1.8/Sortable#method-serialize)。它可以让你更容易坚持位置数据。 –
@FrédéricHamidi谢谢,我认为那就是我真正需要的。 –