I use a carousel in Sencha Touch 2. How I can handle swipe-left and swipe-right events ?
One way is to listen to the swipe event on your carousel items along with using Ext.event.Event.direction to handle the direction of your swipe:
listeners: {
initialize: function(c) {
this.element.on({
swipe: function(e, node, options) {
if(e.direction == "left") {
alert("Hey! I swipe left");
} else {
alert("Hey! I swipe right");
}
}
});
}
}
Working Demo: http://www.senchafiddle.com/#TLBZB
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With