mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-10-05 01:44:18 +00:00
Datepicker: Fixed #4691 Datepicker positioning is off if the window has almost the same height as the calendar div
This commit is contained in:
parent
ef4000d9df
commit
1df4659b7d
@ -693,8 +693,10 @@ $.extend(Datepicker.prototype, {
|
||||
offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;
|
||||
|
||||
// now check if datepicker is showing outside window viewport - move to a better place if so.
|
||||
offset.left -= (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ? Math.abs(offset.left + dpWidth - viewWidth) : 0;
|
||||
offset.top -= (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ? Math.abs(offset.top + dpHeight + inputHeight*2 - viewHeight) : 0;
|
||||
offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
|
||||
Math.abs(offset.left + dpWidth - viewWidth) : 0);
|
||||
offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
|
||||
Math.abs(offset.top + dpHeight + inputHeight * 2 - viewHeight) : 0);
|
||||
|
||||
return offset;
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user