mirror of
https://github.com/jquery/jquery-ui.git
synced 2026-02-16 04:55:13 -05:00
datepicker: fixes #3863: fixed vertical position when scroll position is present and added a viewport visual testcase.
This commit is contained in:
@@ -617,14 +617,14 @@ $.extend(Datepicker.prototype, {
|
||||
var dpHeight = inst.dpDiv.outerHeight();
|
||||
var inputWidth = inst.input ? inst.input.outerWidth() : 0;
|
||||
var inputHeight = inst.input ? inst.input.outerHeight() : 0;
|
||||
var viewWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
|
||||
var viewHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
|
||||
var viewWidth = (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) + $(document).scrollLeft();
|
||||
var viewHeight = (window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight) + $(document).scrollTop();
|
||||
|
||||
offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0);
|
||||
offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0;
|
||||
offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;
|
||||
|
||||
// now check if datepicker is showing outside window viewpoint - move to a better place if so.
|
||||
// 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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user