jQuery in Action
304
CHAPTER 9
Prominent, powerful, and practical plugins
If all we want to do is to temporarily suspend an element's draggability and restore
it at a later time, we disable draggability with
it at a later time, we disable draggability with
draggableDisable()
and restore it
with
draggableEnable()
.
Through the use of the
UI
Draggables Lab, let's examine the draggable options.
Bring up the page chapter9/ui/lab.draggables.html in your browser, and you'll
see the display of figure 9.10.
see the display of figure 9.10.
This lab page sports a now-familiar layout: a Control Panel pane contains con-
trols that allow us to specify the options for
draggable()
, a Test Subject pane
contains an image element to serve as the draggable test subject, and a Console
pane reports information about an ongoing drag operation.
pane reports information about an ongoing drag operation.
When the Apply button (found in the Control Panel) is clicked, the specified
options are collected and a
draggable()
command is issued. The format of the
command is displayed below the Apply button. (For clarity, only the options spec-
ified via the Control Panel are displayed. The callbacks added to the options to
effect the display in the Console pane aren't shown but are included in the com-
mand that's issued.) You'll observe the actions of the Disable and Enable buttons
in exercise 3. The Reset button restores the option controls to initial conditions
and destroys any draggable capability set on the test subject.
ified via the Control Panel are displayed. The callbacks added to the options to
effect the display in the Console pane aren't shown but are included in the com-
mand that's issued.) You'll observe the actions of the Disable and Enable buttons
in exercise 3. The Reset button restores the option controls to initial conditions
and destroys any draggable capability set on the test subject.
Command syntax: draggableDisable
draggableDisable()
Suspends draggability of the wrapped draggable elements without removing the draggability
information or options
information or options
Parameters
none
Returns
The wrapped set
The wrapped set
Command syntax: draggableEnable
draggableEnable()
Restores draggability to any draggables in the matched set that have been disabled via
draggableDisable()
draggableDisable()
Parameters
none
Returns
The wrapped set
The wrapped set