-
Notifications
You must be signed in to change notification settings - Fork 10
/
readme
27 lines (24 loc) · 942 Bytes
/
readme
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
This is a ported library from Jin.js::gestures.
It basically allows you to have unified gesture on both touch and mouse devices to 'grab' onto objects and cast events to that.
It provides the event objects with three pieces of information:
* position (pageX and pageY)
* move (how much mouse moved since previous event)
* offset (how much mouse has moved since start)
* start
Example:
$('div').grab({
onstart: function(e){
this.innerHTML = 'Started at ' + e.position.x + ', ' + e.position.y + '<br />';
},
onmove: function(e){
$(this).css({
left: (e.move.x < 0 ? '' : '+') + e.move.x + 'px',
top: (e.move.y < 0 ? '' : '+') + e.move.y + 'px'
});
},
onfinish: function(e){
this.innerHTML += 'Finished at ' + e.offset.x + ', ' + e.offset.y + '<br />';
this.innerHTML += e.passdata;
},
passdata: 'The stuff got succesfully passed.' // you can name this argument whatever you like, the whole object is passed on.
});