Skip to content
Browse files

Merge pull request #6 from dirkmc/master

Only prevent default behaviour for touch candidates
  • Loading branch information...
2 parents c406188 + 675cd2b commit 44d677b942146fec3554ffab1c5394309b38bfdc @joehewitt committed
Showing with 13 additions and 9 deletions.
  1. +13 −9 scrollability.js
View
22 scrollability.js
@@ -43,6 +43,11 @@ var scrollers = {
};
function onTouchStart(event) {
+ var candidates = getTouchTargets(event.target);
+ if (!candidates.length) {
+ return true;
+ }
+
event.preventDefault();
var touched = null;
@@ -63,18 +68,17 @@ function onTouchStart(event) {
touchTargets = [];
var startTime = new Date().getTime();
- var candidates = getTouchTargets(event.target);
- if (candidates.length) {
- for (var i = 0; i < candidates.length; ++i) {
- var target = createTarget(candidates[i], touchX, touchY, startTime);
- if (target) {
- touchTargets.push(target);
- }
- }
- animationInterval = setInterval(touchAnimation, 0);
+ for (var i = 0; i < candidates.length; ++i) {
+ var target = createTarget(candidates[i], touchX, touchY, startTime);
+ if (target) {
+ touchTargets.push(target);
+ }
}
+ animationInterval = setInterval(touchAnimation, 0);
+
+
var d = document;
d.addEventListener('touchmove', onTouchMove, false);
d.addEventListener('touchend', onTouchEnd, false);

0 comments on commit 44d677b

Please sign in to comment.
Something went wrong with that request. Please try again.