Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
draggable-elm
Advanced tools
This package has been replaced by a modern alternative.
See draggables on npm.
Makes elements draggable. Vanilla style.
const draggable = require('draggable-elm');
const myElm = document.getElementById('target');
draggable(myElm, {options});
classname
- String. A replacement for the draggable
classname.axis
- String. Restrict movement along a single axis, 'x'
or 'y'
.grip
- Element | String (element selector). A grip handle element to activate draggability upon mouse down. By default you can start dragging from anywhere within the main element.Calling the draggable()
function returns a Draggable
instance:
const d = draggable(elm);
It has the following methods:
Toggle draggability. When disabled, the main element gets a 'drag-disabled'
classname.
Sets a new grip handle. Argument could be either an HTML Element or an element selector string (e.g. '#my-grip'
). See the grip
option above.
Listen to drag and drop events:
'drag-start'
- dragging started, on mouse down.'dragging'
- moving around, on mouse move (with mouse down)'drag-stop'
- dragging stopped, on mouse up.Event Aliases
For extra convenience, anything that contains start
, stop
/end
/drop
or ing
will match its respective event.
Sets the element relative position. It utilizes css translate(x, y)
.
Does not accumulate. Every call sets the element position relative to its original position and not relative to its current position.
This method wan't made to be used during an active dragging, but for one-time positioning.
Kills the Draggable
instance for good, unbinds events, releases element references.
For styling, the main element will be given the following classes:
'draggable'
- from initialization until destruction.'dragging'
- on mouse down, until mouse up.Any element that is set as a grip handle will be given the classname: 'drag-grip-handle'
.
FAQs
Makes elements draggable. Vanilla style.
We found that draggable-elm demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.