Skip to content

Commit

Permalink
Added some very short documentation to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
joschi127 committed Aug 12, 2015
1 parent 697f2a5 commit 6666732
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,44 @@
# jquery-touch-gestures
jQuery Touch Gestures based touch.js Gist by Vitaly Rotari, which is a ported version from QuoJS Touch Gestures originally implemented by Javi Jiménez Villar

Adds support for the following gesture events to jQuery: (based on the very good implementation from QuoJS)

* singleTap
* doubleTap
* hold
* swipe
* swiping
* swipeLeft
* swipeRight
* swipeUp
* swipeDown
* rotate
* rotating
* rotateLeft
* rotateRight
* pinch
* pinching
* pinchIn
* pinchOut
* drag
* dragLeft
* dragRight
* dragUp
* dragDown

Example for "pinching":

$(document).ready(function() {
var currentZoom = 1;
var pinchStartZoom = null;
$('.some-class').on('touchstart', function (evt, params) {
pinchStartZoom = currentZoom;
});
$('.some-class').on('pinching', function (evt, params) {
var scale = ($(window).height() + params.distance) / $(window).height();
currentZoom = pinchStartZoom * scale;
console.log("currentZoom: ", currentZoom);
});
});

Use all other events with .on() in a similar way.

0 comments on commit 6666732

Please sign in to comment.