Skip to content

Commit 5bd6a52

Browse files
committed
Add config option for event prevention [#1]
1 parent e757296 commit 5bd6a52

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ This won't have any effect on non-touch devices. You can rely on:
2020
Global setting:
2121

2222
$.detectSwipe.threshold // The number of pixels your finger must move to trigger a swipe event. Defaults is 20.
23+
$.detectSwipe.preventDefault // Should touchmove events be prevented? Defaults to true.

jquery.detect_swipe.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
/**
2-
* jquery.detectSwipe v2.0
2+
* jquery.detectSwipe v2.1
33
* jQuery Plugin to obtain touch gestures from iPhone, iPod Touch, iPad and Android
44
* http://github.com/marcandre/detect_swipe
55
* Based on touchwipe by Andreas Waltl, netCU Internetagentur (http://www.netcu.de)
66
*/
77
(function($) {
88

99
$.detectSwipe = {
10-
version: '2.0.0',
10+
version: '2.1.0',
1111
enabled: 'ontouchstart' in document.documentElement,
12+
preventDefault: true,
1213
threshold: 20
1314
};
1415

@@ -17,7 +18,7 @@
1718
isMoving = false;
1819

1920
function onTouchMove(e) {
20-
e.preventDefault();
21+
if ($.detectSwipe.preventDefault) { e.preventDefault(); }
2122
if(isMoving) {
2223
var x = e.touches[0].pageX;
2324
var y = e.touches[0].pageY;

0 commit comments

Comments
 (0)