2012-08-01 54 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. 
} 

希望此作品

相關問題