# @autots/dragable

> a dragable lib

Latest version **0.0.3** (published 2019-10-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install @autots/dragable
pnpm add @autots/dragable
yarn add @autots/dragable
bun add @autots/dragable
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2019-10-17 |
| First published | 2019-10-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 102.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Magn Mah |
| Maintainers | autots |
| Keywords | dragable, scroll |

## Links

- npm: https://www.npmjs.com/package/@autots/dragable
- Repository: https://github.com/magnnus/dragable
- Issues: https://github.com/magnnus/dragable/issues
- npm.io page: https://npm.io/package/@autots/dragable

## Recent versions

- 0.0.3 (latest) — 2019-10-17
- 0.0.2 — 2019-10-17

## README

# Dragable

a dragable lib to let a HTMLElement to be dragable in a container.

## Features

+ typescript features & vanilla js    
+ support ie9+

## Installing

Using npm:

```
$ npm install @autots/dragable -S
```

Using yarn:

```
$ yarn add @autots/dragable
```

## Example

### layouts

```
<section id="demo1">
  <div class="child1">drag area</div>
</section>

<section id="limit-container">
  <div id="demo2">
    <div class="child2">drag area1</div>
    <div class="child2">drag area2</div>
    <div class="child2">drag area3</div>
  </div>
</section>
```

### import as a module

```
import Dragable from '@autots/dragable';

// 1. The simplest way
new Dragable('#demo1');

// 2. use config
new Dragable('#demo2', {
  container: '#limit-container', // default is window
  dragArea: '.child2',
  zIndex: 100, // default is 999;
})
```

### import as a lib

```
<script src="dist/dragable.min.js"></script>

<script>
  var dragableDemo = new AutoTs.Dragable(el, config);
</script>
```

## Config

| Name | Type | Default | Optional | Description |
|:-----------:|:---------------:|:----------:|:-------:|:-----------------------|
| el | string | - | false | the element can be dragged |
| config.container | window \| string | window | true | the container where the el can move |
| config.dragArea | string | default equals el | true | the elements which can trigger drag behavior |
| config.zIndex | number | 999 | true | the css attr 'z-index' added to el |

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