New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@bufferapp/dragme

Package Overview
Dependencies
Maintainers
9
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bufferapp/dragme

A lightweight module for dragging elements using CSS transforms

  • 0.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-77.78%
Maintainers
9
Weekly downloads
 
Created
Source

@bufferapp/dragme

NPM Version

A super lightweight module for dragging elements using CSS3 Transforms. The goal of this module is to be a minimal way to make certain elements draggable on a page, i.e. modal windows.

Dragme makes use of some modern JS APIs – make sure to polyfill it depending on the browser support wanted:

  • Element.classList
  • Object.assign()
  • Element.closest()

Install

npm install @bufferapp/dragme

Usage

const dragMe = new DragMe(document.querySelector('#draggable-component'));

Prevent dragging on certain elements:

const dragMe = new DragMe(document.querySelector('#draggable-component'), {
  cancel: 'textarea, .button',
});

Cleanup bindings to disable a DragMe instance:

dragMe.cleanup();

Listen to when dragging starts and stops using callbacks:

const dragMe = new DragMe(document.querySelector('#draggable-component'), {
  onDragStart: () => console.log('Started dragging'),
  onDragEnd: () => console.log('Stopped dragging'),
});

Roadmap

  • Use requestAnimationFrame for smoother movement

Contributing

Bug fixes or improvements welcome!

Credits

This builds upon jwilsson's non-jQuery fork of Buffer's jQuery DragMe.

FAQs

Package last updated on 23 Feb 2017

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