最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Combining jQuery Sortable and Drop Event - Stack Overflow

programmeradmin7浏览0评论

Basically I have a draggable list which is connected with a sortable list. Works great except I need some sort of Drop event which I can use to change the list item after its dropped into the sortable list.

This works with .draggable -> .droppable but is there a fix for draggable -> .sortable?

Basically I have a draggable list which is connected with a sortable list. Works great except I need some sort of Drop event which I can use to change the list item after its dropped into the sortable list.

This works with .draggable -> .droppable but is there a fix for draggable -> .sortable?

Share Improve this question asked Feb 24, 2010 at 3:09 mikemike 1,5463 gold badges17 silver badges25 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 16

Figured out, turns out there is a receive event which is the same as drop for the droppable.

$('.selector').sortable({
  receive: function(event, ui) { ... }
});

Why don't you use 2 sortable lists that are connected ? Then you can use the stop event

You can connect 2 lists by doing:

$("#sortable1, #sortable2").sortable({
        connectWith: '.connectedSortable'
}).disableSelection();

And then use the stop event

$( ".selector" ).sortable({
   stop: function(event, ui) { ... }
});

You can then change the dropped element by doing ui. (don't know this by heart but with the draggable plugin its ui.draggable)

发布评论

评论列表(0)

  1. 暂无评论