# unidragger

> Base draggable class

Latest version **3.0.1** (published 2022-03-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install unidragger
pnpm add unidragger
yarn add unidragger
bun add unidragger
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.1 |
| Published | 2022-03-05 |
| First published | 2015-01-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 11.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 85 |
| Author | David DeSandro |
| Maintainers | desandro |
| Keywords | draggable, flickity, draggabilly, browser, dom |

## Links

- npm: https://www.npmjs.com/package/unidragger
- Repository: https://github.com/metafizzy/unidragger
- Issues: https://github.com/metafizzy/unidragger/issues
- npm.io page: https://npm.io/package/unidragger

## Dependencies (1)

- [ev-emitter](https://npm.io/package/ev-emitter.md) ^2.0.0

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 3.0.1 (latest) — 2022-03-05
- 3.0.0 — 2021-12-29
- 2.4.0 — 2021-12-19
- 2.3.1 — 2020-03-29
- 2.3.0 — 2018-03-27
- 2.2.3 — 2017-07-06
- 2.2.2 — 2017-06-01
- 2.2.1 — 2017-05-23
- 2.2.0 — 2017-05-15
- 2.1.0 — 2016-01-17
- 2.0.0 — 2016-01-03
- 1.1.5 — 2015-09-01
- 1.1.4 — 2015-08-31
- 1.1.3 — 2015-04-27
- 1.1.2 — 2015-04-27
- … 6 more at https://npm.io/package/unidragger/versions

## README

# Unidragger

_Base draggable class_

Used in [Flickity](https://flickity.metafizzy.co) and [Draggabilly](https://draggabilly.desandro.com).

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

``` js
// 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 🌈🐻](https://metafizzy.co)

---
_Source: https://npm.io/package/unidragger · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
