-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added some very short documentation to readme
- Loading branch information
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |