Skip to content

Commit

Permalink
Added swipe event triggering when using MSGesture
Browse files Browse the repository at this point in the history
  • Loading branch information
charsleysa committed Sep 13, 2013
1 parent 0fcda59 commit 2d305a8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/touch.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,23 @@
touch = {}
}

var gesture;
if ('undefined' !== typeof(MSGesture)) {
gesture = new MSGesture();
gesture.target = document.body;
}

$(document).ready(function(){
var now, delta

$(document.body)
.bind('MSGestureEnd', function(e){
var swipe_dir = e.velocityX > 1 ? 'Right' : e.velocityX < -1 ? 'Left' : e.velocityY > 1 ? 'Down' : e.velocityY < -1 ? 'Up' : null;
if (swipe_dir) {
touch.el.trigger('swipe')
touch.el.trigger('swipe'+ swipe_dir)
}
})
.on('touchstart MSPointerDown', function(e){
if(e.type == 'MSPointerDown' && (e.pointerType != e.MSPOINTER_TYPE_TOUCH || !e.isPrimary)) return;
now = Date.now()
Expand Down

0 comments on commit 2d305a8

Please sign in to comment.