File tree Expand file tree Collapse file tree 2 files changed +26
-3
lines changed Expand file tree Collapse file tree 2 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,17 @@ test('of', function() {
128
128
left : $ ( document ) . width ( ) - 10
129
129
} , 'document' ) ;
130
130
131
+ $ ( '#elx' ) . position ( {
132
+ my : 'right bottom' ,
133
+ at : 'right bottom' ,
134
+ of : $ ( document ) ,
135
+ collision : 'none'
136
+ } ) ;
137
+ same ( $ ( '#elx' ) . offset ( ) , {
138
+ top : $ ( document ) . height ( ) - 10 ,
139
+ left : $ ( document ) . width ( ) - 10
140
+ } , 'document' ) ;
141
+
131
142
$ ( '#elx' ) . position ( {
132
143
my : 'right bottom' ,
133
144
at : 'right bottom' ,
@@ -139,6 +150,17 @@ test('of', function() {
139
150
left : $ ( window ) . width ( ) - 10
140
151
} , 'window' ) ;
141
152
153
+ $ ( '#elx' ) . position ( {
154
+ my : 'right bottom' ,
155
+ at : 'right bottom' ,
156
+ of : $ ( window ) ,
157
+ collision : 'none'
158
+ } ) ;
159
+ same ( $ ( '#elx' ) . offset ( ) , {
160
+ top : $ ( window ) . height ( ) - 10 ,
161
+ left : $ ( window ) . width ( ) - 10
162
+ } , 'window' ) ;
163
+
142
164
$ ( window ) . scrollTop ( 500 ) . scrollLeft ( 200 ) ;
143
165
$ ( '#elx' ) . position ( {
144
166
my : 'right bottom' ,
Original file line number Diff line number Diff line change @@ -26,21 +26,22 @@ $.fn.position = function( options ) {
26
26
options = $ . extend ( { } , options ) ;
27
27
28
28
var target = $ ( options . of ) ,
29
+ targetElem = target [ 0 ] ,
29
30
collision = ( options . collision || "flip" ) . split ( " " ) ,
30
31
offset = options . offset ? options . offset . split ( " " ) : [ 0 , 0 ] ,
31
32
targetWidth ,
32
33
targetHeight ,
33
34
basePosition ;
34
35
35
- if ( options . of . nodeType === 9 ) {
36
+ if ( targetElem . nodeType === 9 ) {
36
37
targetWidth = target . width ( ) ;
37
38
targetHeight = target . height ( ) ;
38
39
basePosition = { top : 0 , left : 0 } ;
39
- } else if ( options . of . scrollTo && options . of . document ) {
40
+ } else if ( targetElem . scrollTo && targetElem . document ) {
40
41
targetWidth = target . width ( ) ;
41
42
targetHeight = target . height ( ) ;
42
43
basePosition = { top : target . scrollTop ( ) , left : target . scrollLeft ( ) } ;
43
- } else if ( options . of . preventDefault ) {
44
+ } else if ( targetElem . preventDefault ) {
44
45
// force left top to allow flipping
45
46
options . at = "left top" ;
46
47
targetWidth = targetHeight = 0 ;
You can’t perform that action at this time.
0 commit comments