Skip to content

Commit

Permalink
Add config option for event prevention [#1]
Browse files Browse the repository at this point in the history
  • Loading branch information
marcandre committed Mar 26, 2014
1 parent e757296 commit 5bd6a52
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ This won't have any effect on non-touch devices. You can rely on:
Global setting:

$.detectSwipe.threshold // The number of pixels your finger must move to trigger a swipe event. Defaults is 20.
$.detectSwipe.preventDefault // Should touchmove events be prevented? Defaults to true.
7 changes: 4 additions & 3 deletions jquery.detect_swipe.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
/**
* jquery.detectSwipe v2.0
* jquery.detectSwipe v2.1
* jQuery Plugin to obtain touch gestures from iPhone, iPod Touch, iPad and Android
* http://github.com/marcandre/detect_swipe
* Based on touchwipe by Andreas Waltl, netCU Internetagentur (http://www.netcu.de)
*/
(function($) {

$.detectSwipe = {
version: '2.0.0',
version: '2.1.0',
enabled: 'ontouchstart' in document.documentElement,
preventDefault: true,
threshold: 20
};

Expand All @@ -17,7 +18,7 @@
isMoving = false;

function onTouchMove(e) {
e.preventDefault();
if ($.detectSwipe.preventDefault) { e.preventDefault(); }
if(isMoving) {
var x = e.touches[0].pageX;
var y = e.touches[0].pageY;
Expand Down

0 comments on commit 5bd6a52

Please sign in to comment.