Skip to content
Permalink
Browse files

Datepicker: Fixed #4691 Datepicker positioning is off if the window h…

…as almost the same height as the calendar div
  • Loading branch information
Keith Wood
Keith Wood committed Jul 22, 2009
1 parent ef4000d commit 1df4659b7d707987bd18c098eb0ff32e27a1fba4
Showing with 4 additions and 2 deletions.
  1. +4 −2 ui/ui.datepicker.js
@@ -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;
},

0 comments on commit 1df4659

Please sign in to comment.
You can’t perform that action at this time.