$('.selector').simpleSwipe({
onComplete: function(direction){
console.log(direction); // left | right | up | down
}
});
http://habibhadi.com/lab/jQuery-simple-swipe/
bower install simple-swipe --save-dev
draggingClass: 'is-dragging',
dragClass: 'is-draggable',
move: true,
moveX: true,
moveY: true,
onComplete: function(direction){},
moveBack: false
When you swipe/ drag this class will add and automatically remove when event completed.
This call add when you initialize the plugin
true: draggable element moves with mouse move false: draggable element doesn't move but it triggers all other events
true: moves to x axis false: doesn't moves to x axis
true: moves to y axis false: doesn't moves to y axis
true: move back to position where element was false: doesn't moves back to old position
It gives you swipe event or mouse move direction
onComplete: function(direction){
console.log(direction);
}
$('.selector').simpleSwipe({
draggingClass: 'is-dragging',
dragClass: 'is-draggable',
move: true,
moveX: true,
moveY: true,
onComplete: function(direction){
console.log(direction);
},
moveBack: true
});
.is-draggable {
transition: transform 250ms ease-in;
}
.is-dragging {
transition-property: none !important;
cursor: move !important;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}