Droppable elements in jQuery
Press the left mouse key and drag this element to its destination in your screen.
destination source:https://www.plus2net.com/jquery/droppable.php
Droppable elements in jQuery
Options | Details |
---|---|
accept | Type : Selector or Function Default value "*" Which draggable element is accepted by droppable ( target ) Reading the option value already set for accepting dragged element. We can set the option value |
activeClass | Type : String Default value : false The class will be added to droppable when the draggable is on move. This is calculated on every mouse move if refreshPositions is set to true. To read value To set the value |
addClasses | Type : Boolean Default value : true It will stop adding ui-droppable class if set to false. To read value To set the value |
classes | Type : Object Default value :{} We can add classes to widget's element. We can override these class names. ui-droppable ui-droppable-active ui-droppable-hover To read value (ui-droppable) To set the value To read value (ui-droppable-active) ( When draggable is on move ) To set the value To read value (ui-droppable-hover) ( When draggable is hovering over droppable ) To set the value |
disabled | Type : Boolean Default value : false It will disable the droppable if set to true. To read value To set the value |
greedy | Type : Boolean Default value : false In a nested droppables all elements will receive the draggable element. If we set the greedy to true then parent element ( droppables ) can't receive the draggable element. By using event.target.id we will display the id of the droppable elements which are received the draggable element. To read value To set the value |
hoverClass | Type : String Default value : false When draggable is hovering over the droppable , the class specified by hoverClass is applied. To read value To set the value |
scope | Type : String Default value : "default" When a group of draggable and droppable are there, then draggable with same scope value as droppable will be accepted. To read value To set the value |
tolerance | Type : String Default value : "intersect" Deciding How draggable will hover over the droppable "fit": Draggable overlaps the droppable ( 100 % ) entirely. "intersect": Draggable overlaps the droppable at least 50% in both directions. "pointer": Mouse pointer overlaps the droppable. "touch": Draggable overlaps the droppable any amount. To read value To set the value |
destroy | Destory the droppable element |
disable | Disables the droppable element |
enable | Enables the droppable element |
instance() | Retrieves the droppable's instance object |
option(optionName) | We can get value by using optionName as input. We can get name value pair by using option as object. |
widget | Returns jquery object representing droppable element. |
activate | This event is triggered when the accepted draggable started moving ( dragged ). This event is not trigged when the draggable element is on move. To understand the event we will try both activate and deactivate ( triggered when draggable stopped moving ) together. |
create | This event is triggered when the droppable element is created. To understand the event we will use one button click function to create a droppable element. |
deactivate | This event is triggered when the accepted draggable stops moving ( dragged ). This event is not trigged when the draggable element is on move. To understand the event we will try both activate and deactivate ( triggered when draggable stopped moving ) together. Try to display the coordinate of draggable element at staring or stopping of movement. Hint : add this line inside the event function var d_position = $('#draggable').position(); |
drop | This event is triggered when the accepted draggable is dropped over the droppable element. The overlapping area based on which drop event is trigged depends on tolerance option of droppable element. To understand drop event we will try both activate and DROP event. |
drop | This event is triggered when draggable element is dropped over droppable element. |
out | This event is triggered when draggable element moves out of droppable element. |
over | This event is triggered when draggable element moves over droppable element. |
Related Article
destination source:https://www.plus2net.com/jquery/droppable.php