Class zDraggable

Description

The zDraggable class creates a draggable element on an HTML page. The element must already be absolutely positioned in order for this to work.

Author:

Nicholas C. Zakas, http://www.nczonline.net/

Version:

1.0

Since:

1.0

Field Summary

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.

Constructor Summary

zDragDropEvent(HTMLElement element, int constraints)
Creates a new instance of zDraggable.

Method Summary

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.

Methods Inherited From 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.

Field Detail

element

public HTMLElement element

The HTML element to be dragged.

Constructor Detail

zDropTarget

public zDragDropEvent()

Creates a new instance of zDragDropEvent.

Method Detail

initDragDropEvent

public void initEvent(String type, boolean cancelable, zEventTarget relatedTarget)

Initializes the event's type, cancelable, and relatedTarget fields to the specified values.

Arguments: