Touch is a no-frills ultra fast "drag" class for MooTools 1.2. It serves the purpose to enable dragging your mouse or finger on normal-sized browsers and mobile safari. Supports safari 3+, mobile safari 2+, firefox 2+, ie 6+. It's API consists in 4 events, 2 public methods and 2 delta values.
This is not, by any means, an idiot-proof drag implementation. The only purpose of this class is to easily retrieve delta values, so that you can use them for dragging, resizing, swiping, or virtual masturbation.
Instantiate Touch with an element you want to read the delta values from:
var touch = new Touch(element);
Add start, move, end and cancel events:
touch.addEvent('start', function(){
});
touch.addEvent('move', function(dx, dy){
});
touch.addEvent('end', function(){
});
touch.addEvent('cancel', function(){
});
You can see a simple drag&drop implementation using Touch.js in this shell.
A note on comments here: These comments are moderated. No comments will show up until they are approved. Comments that are not productive (i.e. inflammatory, rude, etc) will not be approved.
Found a bug in this plugin? Please report it this repository's Github Issues.
blog comments powered by Disqus