Appendix J. Draggables and Droppables

Draggable and Droppable Methods

Method

Description

Return Value

draggable(options)

Makes the selected element(s) draggable. Options can be specified by passing an object literal as the first argument using key, value pairs. For a complete list of options, see the "Draggables Options" section later in this Appendix.

jQuery

draggable('disable')

Disables draggable functionality on the selected element(s).

jQuery

draggable('enable')

Enables draggable functionality on the selected element(s).

jQuery

draggable('destroy')

Completely removes draggable functionality from the selected element(s).

jQuery

droppable(options)

Makes the selected element(s) droppable. Options can be specified by passing an object literal as the first argument using key, value pairs. For a complete list of options, see the "Droppable Options" section later in this Appendix.

Dropset

droppable('disable')

Disables droppable functionality on the selected element(s).

jQuery

droppable('enable')

Enables droppable functionality on the selected element(s).

jQuery

droppable('destroy')

Completely removes droppable functionality from the selected element(s).

jQuery

Draggables Options

Option

Description

Type

appendTo

For a draggable with a helper option specified, the matched element passed to the appendTo option will be used as the helper's container. If not specified, the helper is appended to the same container as the draggable.

Element, Selector

axis

Contains dragging to an X- or Y-axis. Defaults to false.

String

cancel ...

Get Beginning JavaScript® and CSS Development with jQuery now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.