Skip to content

Instantly share code, notes, and snippets.

@kieran
Created April 14, 2011 16:33
Show Gist options
  • Save kieran/919864 to your computer and use it in GitHub Desktop.
Save kieran/919864 to your computer and use it in GitHub Desktop.
still brittle since it depends on active & hover classes, but removing those dependencies should be trivial
$("#element").droppable({
tolerance: 'pointer',
activeClass: 'ui-state-active',
hoverClass: 'ui-state-hover',
drop: function(evt, ui) {
console.log('dropped',evt,ui)
}
});
$('.ui-droppable').live('dropover dropout',function(evt,ui){
//var scope = $(this).droppable('option','scope') // TODO: watch for scope
$('.ui-droppable').droppable('enable')
$('.ui-state-hover').not($('.ui-state-hover').last()).droppable('disable')
}).live('drop',function(evt,ui){
$('.ui-droppable').droppable('enable')
$('.ui-droppable').removeClass('ui-state-hover ui-state-active')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment