diff --git a/bower.json b/bower.json index b9a9da6..12c16ae 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "tap", - "version": "1.0.1", + "version": "1.0.2", "homepage": "http://pukhalski.github.io/tap.js/", "authors": [ "Ilya Pukhalski ", diff --git a/dist/tap.js b/dist/tap.js index 44e0c45..1a459a2 100644 --- a/dist/tap.js +++ b/dist/tap.js @@ -71,7 +71,7 @@ move: function( e ) { if (!coords['start'] && !coords['move']) return false; - + e = utils.getRealEvent( e ); coords.move = [ e.pageX, e.pageY ]; @@ -85,6 +85,15 @@ e = utils.getRealEvent( e ); if ( coords.offset[ 0 ] < Tap.options.fingerMaxOffset && coords.offset[ 1 ] < Tap.options.fingerMaxOffset && !utils.fireFakeEvent( e, Tap.options.eventName ) ) { + if ( window.navigator.msPointerEnabled || window.navigator.pointerEnabled ) { + var preventDefault = function( clickEvent ) { + clickEvent.preventDefault(); + e.target.removeEventListener( 'click', preventDefault ); + }; + + e.target.addEventListener( 'click', preventDefault, false ); + } + e.preventDefault(); } diff --git a/dist/tap.min.js b/dist/tap.min.js index 63f387a..df3030f 100644 --- a/dist/tap.min.js +++ b/dist/tap.min.js @@ -1 +1 @@ -!function(a){var b={},c={};c.attachEvent=function(a,b,c){return a.addEventListener(b,c,!1)},c.fireFakeEvent=function(a,b){return a.target.dispatchEvent(c.createEvent(b))},c.createEvent=function(b){var c=a.document.createEvent("HTMLEvents");return c.initEvent(b,!0,!0),c.eventName=b,c},c.getRealEvent=function(a){return a.originalEvent&&a.originalEvent.touches&&a.originalEvent.touches.length?a.originalEvent.touches[0]:a};var d=[{test:("propertyIsEnumerable"in a||"hasOwnProperty"in document)&&(a.propertyIsEnumerable("ontouchstart")||document.hasOwnProperty("ontouchstart")),events:{start:"touchstart",move:"touchmove",end:"touchend"}},{test:a.navigator.msPointerEnabled,events:{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}},{test:a.navigator.pointerEnabled,events:{start:"pointerdown",move:"pointermove",end:"pointerup"}}];b.options={eventName:"tap",fingerMaxOffset:11};var e,f,g,h,i={};e=function(a){return c.attachEvent(document.body,h[a],g[a])},g={start:function(a){a=c.getRealEvent(a),i.start=[a.pageX,a.pageY],i.offset=[0,0]},move:function(a){return i.start||i.move?(a=c.getRealEvent(a),i.move=[a.pageX,a.pageY],void(i.offset=[Math.abs(i.move[0]-i.start[0]),Math.abs(i.move[1]-i.start[1])])):!1},end:function(a){a=c.getRealEvent(a),i.offset[0]