Handles unified gesture events and will transform(move/scale/rotate) jQuery objects.
jquery.gesture2.js
requires jquery.touch.js
and jquery.gesture.js
on the same page.
Use the following code to initalize transform on gesture on a jQuery object.
$("#touch-target").gesture();
Options can be passed via an optional argument.
$("#touch-target").gesture({ drag: true, scale: true, rotate: true, touchtarget: null });
Name | Type | Default | Description |
---|---|---|---|
drag scale rotate |
boolean | function | true | Whether the jQuery object should drag/scale/rotate. You can pass a function to control the behaviour dynamically |
touchtarget | null | jQuery selector | HTML element | jQuery object | null | Select target which the jQuery object will transform in reponse to. By default (the null value) will make it responds to touch on itself. You can pass document then the jQuery object will transform when there is touch anywhere in the browser tab/window. |
Note: it might not work correctly if the jQuery object has any CSS transform rule applied before any gesture.