aboutsummaryrefslogtreecommitdiffstats
path: root/ui/ui.datepicker.js
diff options
context:
space:
mode:
authorCa-Phun Ung <pazu2k@gmail.com>2009-01-04 09:30:39 +0000
committerCa-Phun Ung <pazu2k@gmail.com>2009-01-04 09:30:39 +0000
commit6fddf7ecf3ec628f1b93532c48aadf0ac61218e2 (patch)
tree5021731379d760945cd1aaff38830dcf7a67cb55 /ui/ui.datepicker.js
parent2d86e486f80bd5cf71db837c73a51befa45c6444 (diff)
downloadjquery-ui-6fddf7ecf3ec628f1b93532c48aadf0ac61218e2.tar.gz
jquery-ui-6fddf7ecf3ec628f1b93532c48aadf0ac61218e2.zip
datepicker: fixes #3232 [Position Problem in IE 6/7]: re-wrote the _checkOffset function to remove browser detection and compact it to 3 lines. Positioning tested and looks good in FF3, Safari3, Opera 9.61, IE6 & 7.
Diffstat (limited to 'ui/ui.datepicker.js')
-rw-r--r--ui/ui.datepicker.js28
1 files changed, 5 insertions, 23 deletions
diff --git a/ui/ui.datepicker.js b/ui/ui.datepicker.js
index 59a330209..9cba3619c 100644
--- a/ui/ui.datepicker.js
+++ b/ui/ui.datepicker.js
@@ -609,32 +609,14 @@ $.extend(Datepicker.prototype, {
if (inst.input && inst.input[0].type != 'hidden' && inst == $.datepicker._curInst)
$(inst.input[0]).focus();
},
-
+
/* Check positioning to remain on screen. */
_checkOffset: function(inst, offset, isFixed) {
- var pos = inst.input ? this._findPos(inst.input[0]) : null;
- var browserWidth = window.innerWidth || (document.documentElement ?
- document.documentElement.clientWidth : document.body.clientWidth);
- var browserHeight = window.innerHeight || (document.documentElement ?
- document.documentElement.clientHeight : document.body.clientHeight);
- var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
- var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
- // reposition date picker horizontally if outside the browser window
- if (this._get(inst, 'isRTL') || (offset.left + inst.dpDiv.width() - scrollX) > browserWidth)
- offset.left = Math.max((isFixed ? 0 : scrollX),
- pos[0] + (inst.input ? inst.input.width() : 0) - (isFixed ? scrollX : 0) - inst.dpDiv.width() -
- (isFixed && $.browser.opera ? document.documentElement.scrollLeft : 0));
- else
- offset.left -= (isFixed ? scrollX : 0);
- // reposition date picker vertically if outside the browser window
- if ((offset.top + inst.dpDiv.height() - scrollY) > browserHeight)
- offset.top = Math.max((isFixed ? 0 : scrollY),
- pos[1] - (isFixed ? scrollY : 0) - (this._inDialog ? 0 : inst.dpDiv.height()) -
- (isFixed && $.browser.opera ? document.documentElement.scrollTop : 0));
- else
- offset.top -= (isFixed ? scrollY : 0);
+ offset.left -= (this._get(inst, 'isRTL') ? (inst.dpDiv.outerWidth() - inst.input.outerWidth()) : 0);
+ offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0;
+ offset.top -= (isFixed && offset.top == (inst.input.offset().top + inst.input.outerHeight())) ? $(document).scrollTop() : 0;
return offset;
- },
+ },
/* Find an object's position on the screen. */
_findPos: function(obj) {