]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Fix touch handling when using jQuery 1775/head
authorPeter Brook <peter.d.brook@gmail.com>
Thu, 7 Mar 2013 23:18:55 +0000 (15:18 -0800)
committerPeter Brook <peter.d.brook@gmail.com>
Thu, 7 Mar 2013 23:18:55 +0000 (15:18 -0800)
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

index 54c467efd46e3c199ae4dd0860ee5196403b1027..df5f7c628ca6981fdb67da7c674e7473e46eee0e 100644 (file)
           }
         })
         .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,
           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;