2012-08-01 50 views
3

当使用over事件时,如何获取当前可丢弃?就目前的下跌而言,我的意思是容器暂时徘徊。可通过事件排序获取当前可丢弃

这里是我的代码来把事情说清楚:

$('#widgets-available, #sidebar-drop, #content-drop, #footer-drop').sortable({ 
    start: function(event, ui) { 
     item = ui.item; 
     newList = oldList = ui.item.parent().parent(); 
    }, 
    over: function(event, ui) {   
     //Get Current droppable?? 
    } 
}).disableSelection(); 

});

+0

您是否找到了解决方案? – 2013-11-20 09:47:54

回答

2

通过“这个”事件类似如下的

over: function(event, ui) {   
     $(this).find('.numdrag').size(); // give the count of elements with class .numdrag in the drop area 
    } 
2

使用......或者你可以使用从该事件的性质,而不是直接做一个发现:

over: function(event) { 
     var myDroppable = event.target; //this is element where it's being dropped 
     var mySortable = event.toElement; //this is the "handle" element that fired the sort event in the first place. 
} 

希望此作品

相关问题