mirror of
https://github.com/xdan/datetimepicker.git
synced 2024-11-18 06:24:22 +00:00
Fix bug: scrolling time div on touchscreens
On touchscreens, the default datetimepicker closes unexpectedly when trying to scroll on the time picker. This is because scrolling triggers touchend event, just like clicking. To fix, we use the touchmove event to determine that we are scrolling, not clicking, using a global variable.
This commit is contained in:
parent
c902770678
commit
24fe9b6bd7
@ -593,6 +593,9 @@ var DateFormatter;
|
|||||||
}
|
}
|
||||||
}(function ($) {
|
}(function ($) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
var currentlyScrollingTimeDiv = false;
|
||||||
|
|
||||||
var default_options = {
|
var default_options = {
|
||||||
i18n: {
|
i18n: {
|
||||||
ar: { // Arabic
|
ar: { // Arabic
|
||||||
@ -2410,8 +2413,13 @@ var DateFormatter;
|
|||||||
});
|
});
|
||||||
|
|
||||||
timebox
|
timebox
|
||||||
|
.on('touchmove', 'div', function () { currentlyScrollingTimeDiv = true; })
|
||||||
.on('touchend click.xdsoft', 'div', function (xdevent) {
|
.on('touchend click.xdsoft', 'div', function (xdevent) {
|
||||||
xdevent.stopPropagation();
|
xdevent.stopPropagation();
|
||||||
|
if (currentlyScrollingTimeDiv) {
|
||||||
|
currentlyScrollingTimeDiv = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
var $this = $(this),
|
var $this = $(this),
|
||||||
currentTime = _xdsoft_datetime.currentTime;
|
currentTime = _xdsoft_datetime.currentTime;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user