Droppable callback to disable
I have a simple draggable and droppable list that essentially uses the
code from the jQuery UI docs ('simple photo manager'):
http://jqueryui.com/demos/droppable/#photo-manager
How would I go about limiting the number of items in the droppable
target div? For example, in the simple photo manager linked above, say
I want to limit the number of items that get put in the trash to two.
If the user then drags another photo into the trash (photo number 3),
it does not get accepted.
I have looked at the excepted elements example (http://jqueryui.com/
demos/droppable/#accepted-elements) which I guess could be a method:
if the number of items in the trash is two, then change the class on
all the other remaining photos to be non-droppable. If the number of
items in the trash is less than two, then keep the class assignment as
droppable.
Does this seem like a good approach? Thanks in advance.