views:

526

answers:

2

I have a jQuery UI draggable and several separately-defined droppables. Because one of the droppables is configured tolerance: 'intersect', it's possible for a draggable to be dropped on more than one kind of droppable at the same time.

What's the best way to prevent the unintended droppables from firing? Basically, I'd like to prioritize the droppables so that the droppables with tolerance: 'intersect' don't get triggered if another droppable was triggered.

Update - More info to clarify things:

  • All of the droppables are configured tolerance: 'pointer' except for one class of droppable with tolerance: 'intersect'.

  • The reason one class of droppable has tolerance: 'intersect' is that the droppables are really narrow, and users have problems finding them with tolerance: 'pointer'.

  • Moving the droppables further apart isn't an option.

  • None of the droppables overlap, but the draggable is large enough to overlap a droppable with tolerance: 'intersect' while the mouse pointer is over another droppable with tolerance: 'pointer'. At most two droppables can be triggered at once in this way.

  • The UI is laid out so the user's intentions can be determined by ignoring the tolerance: 'intersect' droppable if another droppable has been triggered; i.e. if the user moved the mouse pointer over a droppable with tolerance: 'pointer', it's safe to assume that he/she intended to drop it there. Problem is, I can't figure out how to ignore the unwanted droppable.

A: 

Move them physically distant from one another so that they cannot be dropped on simultaneously. Otherwise, how are you supposed to determine what the user intended? Are you going to calculate percentages of the draggable on each intersecting droppable?

Jason
Hi Jason, thanks for your answer. Please see the first Update in my original question for answers to your questions.
bryan
can you take a screen shot of what you're trying to accomplish?
Jason
A: 

Maybe in the over event of the "less preferred" droppable you could check if the draggable is also over the "preferred" droppable and if it is disable the "less preferred" droppable.

Sorry for the terminology, just trying to brainstorm.

Andy Gaskell