--- layout: api title: "v1.6.2 API: L.Draggable" categories: api version: v1.6.2 permalink: /api/v1.6.2/l-draggable ---
A class for making DOM elements draggable (including touch support). Used internally for map and marker dragging. Only works for elements that were positioned with DomUtil#setPosition
var draggable = new L.Draggable(elementToDrag);
draggable.enable();
Creation | Description |
---|---|
new L.Draggable(
|
Creates a Draggable object for moving the given element when you start dragging the dragHandle element (equals the element itself by default). |
You can subscribe to the following events using these methods.
Event | Data | Description |
---|---|---|
dragstart |
Event |
Fired when the dragging starts. |
predrag |
Event |
Fired continuously during dragging before each corresponding update of the element position. |
drag |
Event |
Fired continuously during dragging. |
dragend |
Event |
Fired when the dragging ends. |
Method | Returns | Description |
---|---|---|
enable() |
- |
Enables the dragging ability. |
disable() |
- |
Disables the dragging ability. |