Skip to content

Commit 6224bb1

Browse files
committed
Add enabled
1 parent 42832d3 commit 6224bb1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,7 @@ How to use
1515
.on('swiperight', function(){ /*...*/ })
1616
.on('swipeup', function(){ /*...*/ })
1717
.on('swipedown', function(){ /*...*/ });
18+
19+
This won't have any effect on non-touch devices. You can rely on:
20+
21+
$.fn.detectSwipe.enabled // true on touch devices, false otherwise

jquery.detect_swipe.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@
4747
this.addEventListener('touchmove', onTouchMove, false);
4848
}
4949
}
50-
if ('ontouchstart' in document.documentElement) {
50+
if ($.fn.detectSwipe.enabled) {
5151
this.addEventListener('touchstart', onTouchStart, false);
5252
}
5353
});
5454

5555
return this;
5656
};
57-
57+
$.fn.detectSwipe.enabled = 'ontouchstart' in document.documentElement;
5858
})(jQuery);

0 commit comments

Comments
 (0)