File tree Expand file tree Collapse file tree 2 files changed +26
-5
lines changed Expand file tree Collapse file tree 2 files changed +26
-5
lines changed Original file line number Diff line number Diff line change 34
34
< div id ="datepicker-inline "> </ div >
35
35
< input id ="datepicker " type ="text " />
36
36
< input id ="datepicker2 " type ="text " />
37
+ < input id ="datepicker3 " type ="text " />
37
38
< script >
38
39
$ ( function ( ) {
39
40
$ ( "#culture" ) . change ( function ( ) {
78
79
}
79
80
} ) ;
80
81
$ ( "#datepicker, #datepicker2" ) . datepicker ( ) ;
82
+
83
+ var input = $ ( "#datepicker3" ) ;
84
+ var button = $ ( "<button>" ) . insertAfter ( input ) ;
85
+ var picker = $ ( "<div>" ) . css ( {
86
+ position : "absolute"
87
+ } ) . datepicker ( {
88
+ select : function ( event , ui ) {
89
+ input . val ( ui . date ) ;
90
+ picker . datepicker ( "close" ) ;
91
+ } ,
92
+ position : {
93
+ of : input
94
+ }
95
+ } ) . insertAfter ( input ) . hide ( ) ;
96
+ button . click ( function ( ) {
97
+ picker . datepicker ( "open" ) ;
98
+ } ) ;
81
99
} ) ;
82
100
</ script >
83
101
Original file line number Diff line number Diff line change 8
8
$ . widget ( "ui.datepicker" , {
9
9
options : {
10
10
eachDay : $ . noop ,
11
- tmpl : "#ui-datepicker-tmpl"
11
+ tmpl : "#ui-datepicker-tmpl" ,
12
+ position : {
13
+ my : "left top" ,
14
+ at : "left bottom"
15
+ }
12
16
} ,
13
17
_create : function ( ) {
14
18
var self = this ;
@@ -78,11 +82,10 @@ $.widget( "ui.datepicker", {
78
82
} ,
79
83
open : function ( event ) {
80
84
this . picker . fadeIn ( "fast" ) ;
81
- this . picker . position ( {
82
- my : "left top" ,
83
- at : "left bottom" ,
85
+
86
+ this . picker . position ( $ . extend ( {
84
87
of : this . element
85
- } ) ;
88
+ } , this . options . position ) ) ;
86
89
} ,
87
90
close : function ( event ) {
88
91
this . picker . fadeOut ( ) ;
You can’t perform that action at this time.
0 commit comments