Object
zEventTarget
zDraggable
The zDraggable
class creates a draggable element on an HTML page.
The element must already be absolutely positioned in order for this to work.
Nicholas C. Zakas, http://www.nczonline.net/
1.0
1.0
static int |
DRAG_X Indicates the element can be dragged along the x-axis. |
static int |
DRAG_Y Indicates the element can be dragged along the y-axis. |
HTMLElement |
element The element to be dragged. |
zDragDropEvent(HTMLElement element, int constraints) Creates a new instance of zDraggable . |
void |
addDropTarget(zDropTarget dropTarget) Registers a drop target for this draggable element. |
int |
getLeft() Returns the x-coordinate of the draggable element relative to the browser window. |
int |
getTop() Returns the y-coordinate of the draggable element relative to the browser window. |
void |
moveTo(int left, int top) Moves the draggable element to the specified point in the browser window. |
zEventTarget
void |
addEventListener(String type, Function handler) Adds an event handler for the given type of event. |
boolean |
dispatchEvent(zEvent event) Fires an event on the zEventTarget and provides the zEvent
object for contextual information about the event. |
void |
removeEventListener(String type, Function handler) Removes an event handler for the given type of event. |
public HTMLElement element
The HTML element to be dragged.
public zDragDropEvent()
Creates a new instance of zDragDropEvent
.
public void initEvent(String type, boolean cancelable, zEventTarget relatedTarget)
Initializes the event's type
, cancelable
, and
relatedTarget
fields to the specified values.
type
- the type of event that has occurred.cancelable
- whether or not the default action of the event can be cancelled.relatedTarget
- the target related to the event but not the cause of it.