Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 2 bugs #820

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions jquery.datetimepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -1609,7 +1609,7 @@ var datetimepickerFactory = function ($) {
});
month_picker
.find('.xdsoft_prev,.xdsoft_next')
.on('touchend mousedown.xdsoft', function () {
.on('touchstart mousedown.xdsoft', function () {
var $this = $(this),
timer = 0,
stop = false;
Expand All @@ -1636,7 +1636,7 @@ var datetimepickerFactory = function ($) {

timepicker
.find('.xdsoft_prev,.xdsoft_next')
.on('touchend mousedown.xdsoft', function () {
.on('touchstart mousedown.xdsoft', function () {
var $this = $(this),
timer = 0,
stop = false,
Expand Down Expand Up @@ -2264,6 +2264,16 @@ var datetimepickerFactory = function ($) {
} else {
datetimepickerCss[verticalAnchorEdge] = verticalPosition;
}
/**
* Fixes a bug which happens if:
* clicking prev/next while viewing a 6 week month adjusts the height of the calendar to less
* for the prev/next month with 5 only weeks, in which case **when the popup is above the input** by the
* time the mouseup event occurs the prev/next button is no longer underneath the mouse pointer, rather
* whatever was behind the calendar popup, and if that whatever is also a disabled form element then
* the mouseup event is swallowed up and the prev/next repeat becomes an infinite loop.
* One solution is set a fixed height, so that the UI doesn't jump around for better UX when above.
*/
calendar.css({'min-height':verticalAnchorEdge == 'bottom' ? '180px' : ''})

datetimepicker.css(datetimepickerCss);
};
Expand Down