Permalink
Browse files

Prevent scrolling when swipe up/down is detected

  • Loading branch information...
madrobby committed Mar 2, 2013
1 parent ed7b86c commit d945672b89be7957b268e01df1dc6425de5932b1
Showing with 2 additions and 0 deletions.
  1. +2 −0 src/touch.js
View
@@ -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()

5 comments on commit d945672

@wolfv

This comment has been minimized.

Show comment
Hide comment
@wolfv

wolfv May 14, 2013

this breakes scrolling on a list where tap events are attached

this breakes scrolling on a list where tap events are attached

@miniatureape

This comment has been minimized.

Show comment
Hide comment
@miniatureape

miniatureape May 23, 2013

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

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

@AlexWei2013

This comment has been minimized.

Show comment
Hide comment
@AlexWei2013

AlexWei2013 Jun 6, 2013

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

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

@tedzhou

This comment has been minimized.

Show comment
Hide comment
@jediofthecode

This comment has been minimized.

Show comment
Hide comment
@jediofthecode

jediofthecode Aug 4, 2013

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.

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.