Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/icholy/dragevents.jq.js

simple jQuery drag events
https://github.com/icholy/dragevents.jq.js

Last synced: 1 day ago
JSON representation

simple jQuery drag events

Awesome Lists containing this project

README

        

## Simple jQuery drag events

```javascript

var $foo = $('#foo');

$foo.registerDragEvents();

$foo.on('dragstart', function (e) {
console.log('dragstart', e);
});

$foo.on('drag', function (e) {
console.log('drag', e);
});

$foo.on('dragstop', function (e) {
console.log('dragstop', e);
});

```

### Event Properties

Each of the event objects passed into the drag callbacks have the following properties.

```javascript

{
x: ,
y: ,
startX: ,
startY: ,
offsetX: ,
offsetY:
}

```

### Notes

`$.registerDragEvents` takes an optional parameter which limits the scope of the page which is watched for drag events.
This patameter defaults to `document`.