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

unidragger

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unidragger

Base draggable class

  • 3.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Unidragger

Base draggable class

Used in Flickity and Draggabilly.

Unidragger handles all the event binding and handling to support a draggable library.

Features

  • Touch device support: iOS, Android, Microsoft Surface
  • Handles click events in input elements

Install

npm: npm install unidragger

Yarn: yarn add unidragger

Demo code

// your draggable class
function Dragger( elem ) {
  this.element = elem;
}

// use Unidragger as a mixin
extend( Dragger.prototype, Unidragger.prototype );

Dragger.prototype.create = function() {
  // set drag handles
  this.handles = [ this.element ];
  this.bindHandles();
};

Dragger.prototype.dragStart = function( event, pointer ) {
  console.log('drag start');
};

Dragger.prototype.dragMove = function( event, pointer, moveVector ) {
  var dragX = this.dragStartPoint.x + moveVector.x;
  var dragY = this.dragStartPoint.y + moveVector.y;
  this.element.style.left = dragX + 'px';
  this.element.style.top = dragY + 'px';
};

Dragger.prototype.dragEnd = function( event, pointer ) {
  console.log('drag end');
};

MIT license

By Metafizzy 🌈🐻

Keywords

FAQs

Package last updated on 05 Mar 2022

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