From 4abb779249e7c737fbcba51db9113b2f96f5db38 Mon Sep 17 00:00:00 2001 From: Gareth Daunton Date: Wed, 10 Aug 2016 20:05:17 -0400 Subject: [PATCH] Fixed touch events. --- src/definitions/modules/range.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/definitions/modules/range.js b/src/definitions/modules/range.js index df36055a8..54d8dfcf4 100644 --- a/src/definitions/modules/range.js +++ b/src/definitions/modules/range.js @@ -618,11 +618,18 @@ $.fn.range = function(parameters) { return adjustedPos; }, eventPos: function(event, originalEvent) { - if (module.is.vertical()) { - return module.is.touch() ? originalEvent.originalEvent.touches[0].pageY : (typeof event.pageY != 'undefined') ? event.pageY : originalEvent.pageY; - } else { - return module.is.touch() ? originalEvent.originalEvent.touches[0].pageX : (typeof event.pageX != 'undefined') ? event.pageX : originalEvent.pageX; + if(module.is.touch()) { + var + touchY = event.originalEvent.touches[0].pageY || event.originalEvent.changedTouches[0].pageY, + touchX = event.originalEvent.touches[0].pageX || event.originalEvent.changedTouches[0].pageX + ; + return module.is.vertical() ? touchY : touchX; } + var + clickY = event.pageY || originalEvent.pageY, + clickX = event.pageX || originalEvent.pageX + ; + return module.is.vertical() ? clickY : clickX; }, value: function(position) { var