ejDroppable
11 Jul 20183 minutes to read
Plugin to make any DOM element Droppable.
Syntax
$(element).ejDroppable()
Example
<div id="droppable" />
<script>
// Create Draggable
$('#droppable').ejDroppable();
</script>
Requires
-
module:jQuery
-
module:ej.core
-
module:ej.droppable
Members
accept object
Used to accept the specified draggable items.
Default Value
- null
Example
//To set scope API value during initialization
$("#droppable").ejDroppable({ accept: null });
//Get or set the accept API, after initialization:
//Gets the accept value
$("#droppable").ejDroppable('option', 'accept');
scope string
Used to group sets of droppable items, in addition to droppable’s accept option. A draggable with the same scope value as a droppable will be accepted by the droppable.
Default Value
- ‘default’
Example
//To set scope API value during initialization
$("#droppable").ejDroppable({ scope: 'default' });
//Get or set the scope API, after initialization:
//Gets the scope value
$("#droppable").ejDroppable('option', 'scope');
Methods
destroy()
destroy in the Droppable.
Example
<div id="droppable"> </div >
<script>
// Create droppableObj
var droppableObj = $("#droppable").data("ejDroppable");
droppableObj.destroy();
</script>
Events
drop
This event is triggered when the mouse up is moved during the dragging.
Name | Type | Description |
---|---|---|
cancel | boolean | if the event should be canceled; otherwise, false. |
model |
|
returns the autocomplete model |
type | string | returns the name of the event |
target | object | returns the element which accepts the droppable element. |
Example
//drop event for Droppable
$("#droppable").ejDroppable({
drop: function(args) {}
});
out
This event is triggered when the mouse is moved out.
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cancel | boolean | if the event should be canceled; otherwise, false. | ||||||||||||
model |
|
returns the autocomplete model | ||||||||||||
type | string | returns the name of the event | ||||||||||||
target | object | returns the mouse out over the element | ||||||||||||
Name | Type | Description |
---|---|---|
cancel | boolean | if the event should be canceled; otherwise, false. |
model |
|
returns the autocomplete model |
type | string | returns the name of the event |
target | object | returns the mouse over the element |
//drop event for Droppable
$("#droppable").ejDroppable({
over: function(args) {}
});