I'm trying to place an item (the diamond shaped item) in the droppable and that item creates 2 sub-droppables in which you place items, but the thing is I can't seem to get the "greedy" function to work with the generated droppables. Currently I'm only testing it on the second item - left side when generated.
my My jsFiddle.
This is the main dropzone:
$(".objects").droppable({
accept: "#block",
drop: function (ev, ui) {
$(".test").append('Dropped!');
}});
This is the sub-dropzone. On drop there should appear Dropped123! in the bottom code paragraph.
$(".true").droppable({
greedy:true,
accept: "#block",
drop : function (ev, ui) {
$(".test").append('Dropped123!');
}
});
Your problem is that you are trying to bind droppable before you actually have the elements, I have changed your fiddle so now you bind the event to the actual element: http://jsfiddle.net/L22d4x2x/7/
var divTrue = $('<div class="true n_block'+ cloneCount1 +'"></div>');
$(".n_block"+ cloneCount1 ).append(divTrue);
divTrue.droppable({
greedy:true,
accept: "#block",
drop : function (ev, ui) {debugger;
$(".test").append('Dropped123!');
}
});