JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.4/underscore-min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.0.0/backbone-min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/hammer.js/1.0.3/hammer.min.js"></script>
<script src="http://eightmedia.github.io/hammer.js/dist/jquery.hammer.min.js"></script>
<div id="swiping"></div>
CSS
#swiping {
height: 100px;
width: 300px;
text-align: center;
background: blue;
color: white;
}
JavaScript
AppView = Backbone.View.extend({
el: '#swiping',
events: {
'touch': function() {
alert("yeah");
}
},
render: function(){
this.$el.html('<h2>Swipe Me</h2>');
this.$el.hammer(
{
prevent_mouseevents: false
});
},
swipeMe: function(e){
console.log(e);
alert('swiped ' + e.gesture.direction);
}
});
var view = new AppView();
view.render();