jquery.dragger
Dragger is a module that gives you the ability to drag anything with either the mouse or touch events. It doesn't do anything to the element except for add listeners. Add the functions 'start', 'drag', and 'stop' to get the position at each step.
Dragger(element [, options][, bounds])
Example
var dragger = new Dragger('#elementId', {
'start': function (pos) {
},
'drag': function (pos) {
},
'stop': function (pos, hasChanged) {
if (hasChanged) {
}
},
'initX': 0,
'initY': 0,
'allowVerticalScrolling': true,
'allowHorizontalScrolling': true
});
dragger.setPosition({
x: 0,
y: 0
});
dragger.setBounds(
minX: null,
maxX: null,
minY: null,
maxY: null
});
dragger.hasDragged();
dragger.disable();
dragger.enable();
Plugin
The jQuery version supports jQuery objects as the first parameter as well as a jQuery plugin syntax.
var dragger = $('#elementId').Dragger();