concept grid in category javascript

appears as: grid
Prototype and Scriptaculous in Action

This is an excerpt from Manning's book Prototype and Scriptaculous in Action.

Table 7.1. Draggable options

Option

Description

revert A Boolean value that specifies whether the reverteffect callback will be invoked when the drag operation stops. Defaults to false.
snap A dimension (in pixels) used to specify whether movement during a drag operation “snaps” to a grid of that size. Defaults to no snapping.
zindex A value that specifies the CSS z-index to be applied to the element during a drag operation. By default the element’s z-index is set to 1000 while dragging.
ghosting A Boolean value specifying whether ghosting is enabled during a drag operation. Defaults to false (no ghosting).
constraint A setting that constrains movement to the horizontal or vertical axis. By default, no constraint is applied.
handle An element to be used as the handle to start the drag operation. Omitting this option specifies that an element is its own handle.
change A callback function invoked during a drag operation whenever the position of the element changes.
starteffect A callback function invoked at the beginning of a drag operation to apply an effect to the element. By default, an Opacity effect is applied.
reverteffect A callback function invoked at the end of a drag operation to perform whatever operation is appropriate to implement revert. It is only called if revert is true. When enabled, the default behavior is to move the element back to its original position.
endeffect A callback function invoked at the end of a drag operation to apply an effect to the element. By default, the element is returned to normal Opacity.

If you want a grid that isn’t square, you can specify separate horizontal and vertical dimensions for the grid by supplying an array of two elements. The first element specifies the horizontal dimension of the grid, and the second specifies the vertical dimension. Here’s an example:

snap: [100,200]

This would create a grid with horizontal vertices 100 pixels apart and with vertical vertices 200 pixels apart.