From 1c21bd2b9f56fa54a8f035afaded009538371b43 Mon Sep 17 00:00:00 2001 From: Peter Brook Date: Thu, 7 Mar 2013 15:18:55 -0800 Subject: [PATCH] Fix touch handling when using jQuery When using jQuery, events seem to get "fixed" to work around some browser bugs, but this doesn't work perfectly for touches. See (http://www.the-xavi.com/articles/trouble-with-touch-events-jquery) for more details. This meant that if someone used orbit with jQuery rather than zepto, touch handling would be broken due to e.touches being undefined. This fixes that case. --- js/foundation/foundation.orbit.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/js/foundation/foundation.orbit.js b/js/foundation/foundation.orbit.js index 54c467efd..df5f7c628 100644 --- a/js/foundation/foundation.orbit.js +++ b/js/foundation/foundation.orbit.js @@ -177,6 +177,7 @@ } }) .on('touchstart.fndtn.orbit', function(e) { + if (!e.touches) { e = e.originalEvent; } var data = { start_page_x: e.touches[0].pageX, start_page_y: e.touches[0].pageY, @@ -188,6 +189,7 @@ e.stopPropagation(); }) .on('touchmove.fndtn.orbit', function(e) { + if (!e.touches) { e = e.originalEvent; } // Ignore pinch/zoom events if(e.touches.length > 1 || e.scale && e.scale !== 1) return; -- 2.47.3