From 3aeeeeb75af2963e0733be9397314c99fdfba065 Mon Sep 17 00:00:00 2001 From: Ca-Phun Ung Date: Wed, 28 Jan 2009 05:11:10 +0000 Subject: [PATCH] datepicker: fixes #3863: fixed vertical position when scroll position is present and added a viewport visual testcase. --- tests/visual/datepicker/viewport.html | 277 ++++++++++++++++++++++++++ ui/ui.datepicker.js | 6 +- 2 files changed, 280 insertions(+), 3 deletions(-) create mode 100644 tests/visual/datepicker/viewport.html diff --git a/tests/visual/datepicker/viewport.html b/tests/visual/datepicker/viewport.html new file mode 100644 index 000000000..5028342b6 --- /dev/null +++ b/tests/visual/datepicker/viewport.html @@ -0,0 +1,277 @@ + + + + +Mon 26JanTest application details - by chrisv from #3863 (Viewport test) + + + + + + + + + + + +
+
+

Mon 26JanTest

+

Application progress

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
Applic’n rec’d
Stage 1 mtg + + @ + +
  + +
  + + Yes + + No
  + + Yes + + No
 
+ + +
Stage 2 mtg + + @ + +
+ + +
+ + +
+ +
+ + + Yes + + + No
+ + + Yes + + No
+ + + + Yes + + No
+ + + Yes + + No
+ + + + Yes + + No
+ + + Yes + + + No
+ + + Yes + + No
+ + + + Yes + + No
+ + + Yes + + No
Site visit + + @ + +
+ + +
+ + +
+ + + Yes + + + No
Director interview + + @ + + +
+ + +
+ + + Yes + + + No
+ + + Yes + + No
+ + + + Yes + + No
+ + + Yes + + No
+ + + + Yes + + No
+ + + Yes + + + No
+ + +
+
+
+ +
+ + + \ No newline at end of file diff --git a/ui/ui.datepicker.js b/ui/ui.datepicker.js index 831cabc91..c7705949d 100644 --- a/ui/ui.datepicker.js +++ b/ui/ui.datepicker.js @@ -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; -- 2.39.5