Skip to content

Commit

Permalink
Merge pull request #17 from ezhlobo/fix_click_on_wp
Browse files Browse the repository at this point in the history
Fix preventing default behavior of events in windows phone
  • Loading branch information
pukhalski committed Jan 21, 2015
2 parents 91a2b08 + 84c7628 commit da233a5
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tap",
"version": "1.0.1",
"version": "1.0.2",
"homepage": "http://pukhalski.github.io/tap.js/",
"authors": [
"Ilya Pukhalski <[email protected]>",
Expand Down
11 changes: 10 additions & 1 deletion dist/tap.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@

move: function( e ) {
if (!coords['start'] && !coords['move']) return false;

e = utils.getRealEvent( e );

coords.move = [ e.pageX, e.pageY ];
Expand All @@ -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();
}

Expand Down
2 changes: 1 addition & 1 deletion dist/tap.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion src/tap.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

move: function( e ) {
if (!coords['start'] && !coords['move']) return false;

e = utils.getRealEvent( e );

coords.move = [ e.pageX, e.pageY ];
Expand All @@ -34,6 +34,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();
}

Expand Down

0 comments on commit da233a5

Please sign in to comment.