Advanced touch-compatible Drag'n'Drop library providing Draggable, Droppable and Sortable for Zepto.js and jQuery
Controls which draggable elements are accepted by the droppable.
$('#example-accept-selector').droppable({ accept: '.a' })$('#example-accept-function').droppable({ accept: function(el) {
return el.hasClass('b')
} })If specified, the class will be added to the droppable while an acceptable draggable is being dragged.
$('#example-activeClass').droppable({ activeClass: 'active' })Disables the draggable if set to true.
$('#example-disabled').droppable({ disabled: true })If specified, the class will be added to the droppable while an acceptable draggable is being hovered over the droppable.
$('#example-hoverClass').droppable({ hoverClass: 'drop-here' })This function can be used to override the default receive behavior.
$('#example-receiveHandler').droppable({
receiveHandler: function(ui) {
$(this).text(ui.item.text())
ui.item.remove()
}
})Used to group sets of draggable and droppable items, in addition to the accept option. A draggable with the same scope value as a droppable will be accepted.
$('#example-scope').droppable({ scope: 'T' })Removes the draggable functionality completely.
$('#example-destroy').droppable()
$('#example-destroy').droppable('destroy')Disables the draggable.
$('#example-disable').droppable('disable')Enables the draggable.
$('#example-enable').droppable('enable')Gets an object containing key/value pairs representing the current droppable options hash.
var options = $('#example-option').droppable('option')Gets the value currently associated with the specified optionName.
var isDisabled = $('#example-option').droppable('option', 'disabled')Sets the value of the droppable option associated with the specified optionName.
$('#example-option').droppable('option', 'disabled', true)Sets one or more options for the droppable.
$('#example-option').droppable('option', { disabled: true })Triggered when an accepted draggable starts dragging.
$('#example-activate').droppable({ accept: '.c' })
.on('droppable:activate', function(e, ui) {
alert(42)
})Triggered when the droppable is created.
Triggered when an accepted draggable stops dragging.
$('#example-deactivate').droppable({ accept: '.e' })
.on('droppable:deactivate', function(e, ui) {
alert(42)
})Triggered when an accepted draggable is dropped. Calling
e.preventDefault()$('#example-drop').droppable({ accept: '.g' })
.on('droppable:drop', function(e, ui) {
alert(42)
})Triggered when an accepted draggable is dragged out of the droppable.
$('#example-out').droppable({ accept: '.i' })
.on('droppable:out', function(e, ui) {
alert(42)
})Triggered when an accepted draggable is dragged over the droppable.
$('#example-over').droppable({ accept: '.k' })
.on('droppable:over', function(e, ui) {
alert(42)
})