Forcing position of jQuery UI's DatePicker
authorAlexander Ebert <ebert@woltlab.com>
Mon, 29 Apr 2013 20:38:28 +0000 (22:38 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 29 Apr 2013 20:38:28 +0000 (22:38 +0200)
wcfsetup/install/files/js/WCF.js

index 98394d215676ed1e8d6683c08ceeeca8f2d7e455..980f194059e0736b0cc75c5d2f4325face8a5da7 100755 (executable)
@@ -2289,6 +2289,17 @@ WCF.Date.Picker = {
                        $input.datepicker({
                                altField: '#' + $input.wcfIdentify() + 'DatePicker',
                                altFormat: 'yy-mm-dd', // PHPs strtotime() understands this best
+                               beforeShow: function(input, instance) {
+                                       // dirty hack to force opening below the input
+                                       setTimeout(function() {
+                                               instance.dpDiv.position({
+                                                       my: 'left top',
+                                                       at: 'left bottom',
+                                                       collision: 'none',
+                                                       of: input
+                                               });
+                                       }, 1);
+                               },
                                changeMonth: true,
                                changeYear: true,
                                dateFormat: this._dateFormat,
@@ -2340,6 +2351,17 @@ WCF.Date.Picker = {
                                altFieldTimeOnly: false,
                                altFormat: 'yy-mm-dd', // PHPs strtotime() understands this best
                                altTimeFormat: 'HH:mm',
+                               beforeShow: function(input, instance) {
+                                       // dirty hack to force opening below the input
+                                       setTimeout(function() {
+                                               instance.dpDiv.position({
+                                                       my: 'left top',
+                                                       at: 'left bottom',
+                                                       collision: 'none',
+                                                       of: input
+                                               });
+                                       }, 1);
+                               },
                                changeMonth: true,
                                changeYear: true,
                                controlType: 'select',