Question

I need to implement touch based events in backbonejs View. I tried with hammer jquery special events but it didn't work for me.

Was it helpful?

Solution

Try extending the events with the check mobile deveice and add specific events like

events: function() {
    return MOBILE ? 
       {
         "touchstart": 'select'
       } : 
       {
         "mousedown": 'select'
       }
  }

http://jsfiddle.net/dira/Ke2px/2/

As we can see from the question Backbone.js click event doesn't work with touch

OTHER TIPS

use it as a jquery plugin and then normally use the events property to set it up and listen for these events on desired elements

events: {
    'tap': 'onTap',
    'hold .dragging-handle': 'onHold'
    // etc...
},

onTap: function(e) {
    // do whatever with the event data 
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top