mirror of
https://github.com/xdan/datetimepicker.git
synced 2024-11-18 06:24:22 +00:00
Merge pull request #619 from rglasser27/fix-scrolling-for-mobile
Fix an issue with mobile scrolling
This commit is contained in:
commit
63441fde6d
@ -1007,10 +1007,15 @@ var datetimepickerFactory = function ($) {
|
||||
.find('.xdsoft_select')
|
||||
.xdsoftScroller(options)
|
||||
.on('touchstart mousedown.xdsoft', function (event) {
|
||||
this.touchmoved = false;
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
})
|
||||
.on('touchstart mousedown.xdsoft', '.xdsoft_option', function () {
|
||||
.on('touchmove', '.xdsoft_option', function () {
|
||||
this.touchmoved = true;
|
||||
})
|
||||
.on('touchend mousedown.xdsoft', '.xdsoft_option', function () {
|
||||
if (!this.touchmoved) {
|
||||
if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) {
|
||||
_xdsoft_datetime.currentTime = _xdsoft_datetime.now();
|
||||
}
|
||||
@ -1030,6 +1035,7 @@ var datetimepickerFactory = function ($) {
|
||||
if (year !== _xdsoft_datetime.currentTime.getFullYear() && $.isFunction(options.onChangeYear)) {
|
||||
options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
datetimepicker.getValue = function () {
|
||||
@ -1866,7 +1872,14 @@ var datetimepickerFactory = function ($) {
|
||||
});
|
||||
|
||||
timebox
|
||||
.on('touchstart', 'div', function (xdevent) {
|
||||
this.touchmoved = false;
|
||||
})
|
||||
.on('touchmove', 'div', function (xdevent) {
|
||||
this.touchmoved = true;
|
||||
})
|
||||
.on('touchend click.xdsoft', 'div', function (xdevent) {
|
||||
if (!this.touchmoved) {
|
||||
xdevent.stopPropagation();
|
||||
var $this = $(this),
|
||||
currentTime = _xdsoft_datetime.currentTime;
|
||||
@ -1894,6 +1907,7 @@ var datetimepickerFactory = function ($) {
|
||||
if (options.inline !== true && options.closeOnTimeSelect === true) {
|
||||
datetimepicker.trigger('close.xdsoft');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
datepicker
|
||||
|
Loading…
Reference in New Issue
Block a user