Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dflex/draggable

Package Overview
Dependencies
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dflex/draggable

> Draggable is a native utility written in pure JS works for Web and Mobile

  • 0.3.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
80
increased by1500%
Maintainers
1
Weekly downloads
 
Created
Source

@dflex/draggable

Draggable is a native utility written in pure JS works for Web and Mobile

npm install @dflex/draggable

show how draggable works

DFlex draggable is the simplest solution to create JavaScript draggable elements. No need for a special tutorial and thinking about implementation complexity or even migration to different technologies for different frameworks. It can be used with any app you have whether it is React, Vue, Angular or Svelte.s

API

import { store, Draggable } from "@dflex/draggable";

Registry

Register draggable element in draggable store:

store.register({ id: string, element: Node });

Draggable instance

Create draggable instance onmousedown:

const draggable = new Draggable(id: string, {x: event.clientX, y: event.clientY});

Move element onmousemove

draggable.dragAt(event.clientX, event.clientY);

End Dragging onmouseup

draggable.endDragging();
Examples
  • Full React example

  • Full Vue example

Test

yarn test draggable

License

This package is licensed under the GPL-3.0 License

Contribution

If you like this project, you can support it by contributing. If you find a bug, please let me know, applying a pull request is welcome. This project needs your support. You can fix typos, add new examples, or build with me new features.

Support this project by giving it a Star ⭐

Keywords

FAQs

Package last updated on 12 Jan 2021

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc