From d443bae502a8bf1797a1c64838615bbc42d18d50 Mon Sep 17 00:00:00 2001 From: Mike Kamermans Date: Mon, 19 Mar 2018 11:44:43 -0700 Subject: [PATCH] Update jquery.datetimepicker.js --- jquery.datetimepicker.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/jquery.datetimepicker.js b/jquery.datetimepicker.js index 4b26bf4..ddaf2ea 100644 --- a/jquery.datetimepicker.js +++ b/jquery.datetimepicker.js @@ -1060,11 +1060,12 @@ var datetimepickerFactory = function ($) { var handleTouchMoved = function (event) { var evt = event.originalEvent; - this.touchStartPosition = this.touchStartPosition || evt.touches[0] - var touchPosition = evt.touches[0] - var xMovement = Math.abs(this.touchStartPosition.clientX - touchPosition.clientX) - var yMovement = Math.abs(this.touchStartPosition.clientY - touchPosition.clientY) - var distance = Math.sqrt(xMovement * xMovement + yMovement * yMovement) + var position = evt.touches ? evt.touches[0] : evt; + this.touchStartPosition = this.touchStartPosition || position; + var touchPosition = position; + var xMovement = Math.abs(this.touchStartPosition.clientX - touchPosition.clientX); + var yMovement = Math.abs(this.touchStartPosition.clientY - touchPosition.clientY); + var distance = Math.sqrt(xMovement * xMovement + yMovement * yMovement); if(distance > options.touchMovedThreshold) { this.touchMoved = true; }