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() {
128128 left : $ ( document ) . width ( ) - 10
129129 } , 'document' ) ;
130130
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+
131142 $ ( '#elx' ) . position ( {
132143 my : 'right bottom' ,
133144 at : 'right bottom' ,
@@ -139,6 +150,17 @@ test('of', function() {
139150 left : $ ( window ) . width ( ) - 10
140151 } , 'window' ) ;
141152
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+
142164 $ ( window ) . scrollTop ( 500 ) . scrollLeft ( 200 ) ;
143165 $ ( '#elx' ) . position ( {
144166 my : 'right bottom' ,
Original file line number Diff line number Diff line change @@ -26,21 +26,22 @@ $.fn.position = function( options ) {
2626 options = $ . extend ( { } , options ) ;
2727
2828 var target = $ ( options . of ) ,
29+ targetElem = target [ 0 ] ,
2930 collision = ( options . collision || "flip" ) . split ( " " ) ,
3031 offset = options . offset ? options . offset . split ( " " ) : [ 0 , 0 ] ,
3132 targetWidth ,
3233 targetHeight ,
3334 basePosition ;
3435
35- if ( options . of . nodeType === 9 ) {
36+ if ( targetElem . nodeType === 9 ) {
3637 targetWidth = target . width ( ) ;
3738 targetHeight = target . height ( ) ;
3839 basePosition = { top : 0 , left : 0 } ;
39- } else if ( options . of . scrollTo && options . of . document ) {
40+ } else if ( targetElem . scrollTo && targetElem . document ) {
4041 targetWidth = target . width ( ) ;
4142 targetHeight = target . height ( ) ;
4243 basePosition = { top : target . scrollTop ( ) , left : target . scrollLeft ( ) } ;
43- } else if ( options . of . preventDefault ) {
44+ } else if ( targetElem . preventDefault ) {
4445 // force left top to allow flipping
4546 options . at = "left top" ;
4647 targetWidth = targetHeight = 0 ;
You can’t perform that action at this time.
0 commit comments