Draggable
Class Draggable
A draggable and droppable HTML element.
Extends EventTarget
constructor ($el: ElementView, options: DraggableOptions): Draggable
Name | Type | Default | Description |
---|---|---|---|
$el | ElementView | ||
options | DraggableOptions | … |
Method .off (events: string, fn: EventCallback): void
Removes an event listener from one or more events.
Name | Type | Default | Description |
---|---|---|---|
events | string | ||
fn | EventCallback |
Method .on (events: string, fn: EventCallback): void
Adds an event listener for one or more events.
Name | Type | Default | Description |
---|---|---|---|
events | string | ||
fn | EventCallback |
Method .one (events: string, fn: EventCallback): void
Adds a one-time event listener to one or more events.
Name | Type | Default | Description |
---|---|---|---|
events | string | ||
fn | EventCallback |
Method .resetPosition (duration: number): Promise<void>
Name | Type | Default | Description |
---|---|---|---|
duration | number | 250 |
Method .setPosition (x: number, y: number): void
Sets the position of the element.
Name | Type | Default | Description |
---|---|---|---|
x | number | ||
y | number |
Method .trigger (events: string, arg: unknown): void
Triggers one or more events, and executes all bound event listeners.
Name | Type | Default | Description |
---|---|---|---|
events | string | ||
arg | unknown |