Skip to content

Instantly share code, notes, and snippets.

@seanmcn
Last active March 11, 2016 07:41
Show Gist options
  • Save seanmcn/3638884 to your computer and use it in GitHub Desktop.
Save seanmcn/3638884 to your computer and use it in GitHub Desktop.
jQuery Droppable (Accept only one Draggable)
$(".drop_area").droppable({
tolerance: "intersect",
accept: ".drop_item",
greedy: true,
drop : function(event, ui) {
$(this).droppable( "option", "disabled", true );
},
out : function(event, ui) {
$(this).droppable( "option", "disabled", false );
},
revert: function (event, ui) {
$(this).droppable( "option", "disabled", true );
}
});
@seanmcn
Copy link
Author

seanmcn commented Sep 5, 2012

tolerance: interesect probably isn't needed for most projects.

@danivegamx
Copy link

How do you append the draggable object to the droppable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment