]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Better guess about when to add windowScroll offset
authorKevin Ball <kmball11@gmail.com>
Wed, 18 May 2016 22:14:45 +0000 (15:14 -0700)
committerKevin Ball <kmball11@gmail.com>
Wed, 18 May 2016 22:14:45 +0000 (15:14 -0700)
js/foundation.slider.js

index dce1ab2008b6438696fd642cc6fe5519fb3ad958..d609bc77d8a5d45e97b21b30774e93c74629d35c 100644 (file)
@@ -281,7 +281,8 @@ class Slider {
       var elemOffset = this.$element.offset()[direction];
 
       // touch events emulated by the touch util give position relative to screen, add window.scroll to event coordinates...
-      if (eventOffset < elemOffset) { eventOffset = eventOffset + windowScroll; }
+      // best way to guess this is simulated is if screenY ==clientY == pageY
+      if (e.screenY === e.pageY && e.clientY === e.pageY) { eventOffset = eventOffset + windowScroll; }
       var eventFromBar = eventOffset - elemOffset;
       var barXY;
       if (eventFromBar < 0) {