aboutsummaryrefslogtreecommitdiffstats
path: root/ui/ui.datepicker.js
diff options
context:
space:
mode:
authorKeith Wood <kbwood.au@gmail.com>2009-07-22 08:39:44 +0000
committerKeith Wood <kbwood.au@gmail.com>2009-07-22 08:39:44 +0000
commit1df4659b7d707987bd18c098eb0ff32e27a1fba4 (patch)
treeb3a0490ff2e0d4b7bff3a171f9a8a7d7cb2485cb /ui/ui.datepicker.js
parentef4000d9df88a4d9dd3bcae72439c078eff8634b (diff)
downloadjquery-ui-1df4659b7d707987bd18c098eb0ff32e27a1fba4.tar.gz
jquery-ui-1df4659b7d707987bd18c098eb0ff32e27a1fba4.zip
Datepicker: Fixed #4691 Datepicker positioning is off if the window has almost the same height as the calendar div
Diffstat (limited to 'ui/ui.datepicker.js')
-rw-r--r--ui/ui.datepicker.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/ui/ui.datepicker.js b/ui/ui.datepicker.js
index 5f1891fd8..a2bc36623 100644
--- a/ui/ui.datepicker.js
+++ b/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;
},