Sto cercando di ottenere gli eventi hammer js funzionanti con backbone ma non riesco a farlo rispondere agli eventi. Ho provato quanto segue già ..Hammer JS non funziona con backbone
http://cijug.net/tech/2013/01/16/backbone-hammer/
https://gist.github.com/kjantzer/4279025
Ho anche messo sotto pezzo di codice, a mio avviso
initialize: function(){
this.events = _.extend({}, this.defaultEvents, this.events||{});
}
JS Fiddle: http://jsfiddle.net/XcYhD/
Codice
<div id="swiping"></div>
JS
AppView = Backbone.View.extend({
el: '#swiping',
events: {
'swipe': 'swipeMe'
},
render: function(){
this.$el.html('<h2>Swipe Me</h2>');
},
swipeMe: function(e){
alert('swiped ' + e.direction);
}
});
var view = new AppView();
view.render();
librerie incluse - hammer.js, jquery.specialevent.hammer.js, ecc ..
Comunque per farla funzionare?
Eventuali duplicati/soluzione: http://stackoverflow.com/questions/16067989/overriding-backbone-view-delegateevents-so-the-events-object-can -include-mobile. – Loamhoof