Swipe
A cross platform component that announces left and right swiping events
without disabling up and down scrolling on the elements. Just add the
js-onswipe
class to an element and then listen on that element for
:swipe/left
or
:swipe/right
.
html
<article class="eggs js-onswipe" data-threshold="10"></article>
You can also add the
data-threshold
property to set the pixel offset by which one should be required to swipe in
order to trigger a swipe event.
javascript
$(".eggs").on(":swipe/left", function() {
console.log("so you've just left me here?");
});
$(".eggs").on(":swipe/right", function() {
console.log("all right then.");
});