From: Peter Brook Date: Thu, 7 Mar 2013 23:18:55 +0000 (-0800) Subject: Fix touch handling when using jQuery X-Git-Tag: v4.0.5~12^2^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F1775%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git 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. --- 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;