# path-draggable-button

> Drag buttons along an SVG path with jQuery

Latest version **1.0.0** (published 2019-07-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install path-draggable-button
pnpm add path-draggable-button
yarn add path-draggable-button
bun add path-draggable-button
```

## 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 | 1.0.0 |
| Published | 2019-07-04 |
| First published | 2019-07-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 10.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Ryan McCahan |
| Maintainers | mccahan |
| Keywords | svg, path, button, jquery, js |

## Links

- npm: https://www.npmjs.com/package/path-draggable-button
- Repository: https://github.com/lgndhq/path-draggable-button
- Homepage: https://github.com/lgndhq/path-draggable-button#readme
- Issues: https://github.com/lgndhq/path-draggable-button/issues
- npm.io page: https://npm.io/package/path-draggable-button

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.0 (latest) — 2019-07-04

## README

path-draggable-button
-------

This jQuery plugin from [LGND](https://lgnd.com) allows the user to drag a "button" (we typically use an image) along an SVG path, triggering an interaction when it reaches the end of the path.

### Settings

Option | Type | Default | Description
------ | ---- | ------- | -----------
pathSelector | string | "path" | CSS selector for the SVG path to follow
direction | string | "horizontal" | Predominant direction of the path, either "horizontal" or "vertical"
negative | boolean | false | Whether the path is "reversed", e.g. bottom to top or right to left
threshold | float | 0.99 | Percentage (0.0-1.0) of the path the button needs to be dragged before triggering the handler

### Events

Event | Arguments | Description
----- | --------- | -----------
change | event, button, value | When the button is dragged and changes position
finish | event, button | When the button is dragged beyond the `threshold` percentage

### Methods

Methods are called through the pathDraggableButton method, e.g.:

```javascript
// Get percentage (0-1.0) dragged
var distance = $(".toggle-switch").pathDraggableButton('getValue');

// Set to 50% completed
$(".toggle-switch").pathDraggableButton('setValue', 0.5);
```

Method | Argument | Description
------ | -------- | -----------
`getValue` | | Returns the percentage (0-1.0) dragged
`setValue` | value : float | Sets the completion percentage (0-1.0) and moves the button along the path

### Example

Create a draggable button that fades out after completion:

```javascript
$(element).pathDraggableButton({
  direction: 'horizontal'
}).on('finish', function(){
  $(this).fadeOut();
});
```

For more examples, see [https://lgndhq.github.io/path-draggable-button](https://lgndhq.github.io/path-draggable-button)

### Dependencies

jQuery 1.8

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