3.0.1 • Published 3 years ago
unidragger v3.0.1
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 🌈🐻
3.0.1
3 years ago
3.0.0
3 years ago
2.4.0
4 years ago
2.3.1
5 years ago
2.3.0
7 years ago
2.2.3
8 years ago
2.2.2
8 years ago
2.2.1
8 years ago
2.2.0
8 years ago
2.1.0
9 years ago
2.0.0
9 years ago
1.1.5
10 years ago
1.1.4
10 years ago
1.1.3
10 years ago
1.1.2
10 years ago
1.1.1
10 years ago
1.1.0
10 years ago
1.0.0
10 years ago
0.2.1
10 years ago
0.2.0
10 years ago
0.1.0
10 years ago