Skip to content

Commit

Permalink
Prevent scrolling when swipe up/down is detected
Browse files Browse the repository at this point in the history
  • Loading branch information
madrobby committed Mar 2, 2013
1 parent ed7b86c commit d945672
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/touch.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
cancelLongTap()
touch.x2 = e.touches[0].pageX
touch.y2 = e.touches[0].pageY
if (Math.abs(touch.x1 - touch.x2) > 10)
e.preventDefault()
})
.bind('touchend', function(e){
cancelLongTap()
Expand Down

5 comments on commit d945672

@wolfv
Copy link

@wolfv wolfv commented on d945672 May 14, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this breakes scrolling on a list where tap events are attached

@miniatureape
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'm with @wolfv. Changing this threshold to 30 greatly improves scrollling performance.

@AlexWei2013
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as @wolfv's said, but why you added these codes.

@tedzhou
Copy link

@tedzhou tedzhou commented on d945672 Jul 4, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jediofthecode
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also breaks using input[type=range] elements on touch-enabled devices, only allows stepping 1 at a time without having to release and move more.

Please sign in to comment.