@@ -20,30 +20,35 @@ var rhorizontal = /left|center|right/,
20
20
_position = $ . fn . position ;
21
21
22
22
$ . position = {
23
- scrollbarWidth : function ( ) {
24
- var div = $ ( "<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ) ,
25
- innerDiv = div . children ( ) [ 0 ] ,
26
- w1 , w2 ;
27
- $ ( "body" ) . append ( div ) ;
28
- w1 = innerDiv . offsetWidth ;
29
- div . css ( "overflow" , "scroll" ) ;
30
-
31
- w2 = innerDiv . offsetWidth ;
32
-
23
+ scrollbarWidth : function ( ) {
24
+ var w1 , w2 ,
25
+ div = $ ( "<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ) ,
26
+ innerDiv = div . children ( ) [ 0 ] ;
27
+
28
+ $ ( "body" ) . append ( div ) ;
29
+ w1 = innerDiv . offsetWidth ;
30
+ div . css ( "overflow" , "scroll" ) ;
31
+
32
+ w2 = innerDiv . offsetWidth ;
33
+
33
34
if ( w1 === w2 ) {
34
35
w2 = div [ 0 ] . clientWidth ;
35
36
}
36
37
37
- div . remove ( ) ;
38
-
39
- return w1 - w2 ;
38
+ div . remove ( ) ;
39
+
40
+ return w1 - w2 ;
40
41
} ,
41
- getScrollInfo : function ( within ) {
42
+ getScrollInfo : function ( within ) {
42
43
var that = within [ 0 ] ,
43
44
scrollHeight = within . height ( ) < that . scrollHeight ,
44
45
scrollWidth = within . width ( ) < that . scrollWidth ,
45
46
scrollbarWidth = $ . position . scrollbarWidth ( ) ;
46
- return { height : scrollHeight ? scrollbarWidth : 0 , width : scrollWidth ? scrollbarWidth : 0 } ;
47
+
48
+ return {
49
+ height : scrollHeight ? scrollbarWidth : 0 ,
50
+ width : scrollWidth ? scrollbarWidth : 0
51
+ } ;
47
52
}
48
53
} ;
49
54
@@ -85,7 +90,7 @@ $.fn.position = function( options ) {
85
90
}
86
91
87
92
// force my and at to have valid horizontal and vertical positions
88
- // if a value is missing or invalid, it will be converted to center
93
+ // if a value is missing or invalid, it will be converted to center
89
94
$ . each ( [ "my" , "at" ] , function ( ) {
90
95
var pos = ( options [ this ] || "" ) . split ( " " ) ,
91
96
horizontalOffset ,
@@ -302,7 +307,7 @@ $.ui.position = {
302
307
data . targetHeight :
303
308
- data . targetHeight ,
304
309
offset = - 2 * data . offset [ 1 ] ;
305
- if ( overTop < 0 || overBottom > 0 ) {
310
+ if ( overTop < 0 || overBottom > 0 ) {
306
311
position . top += myOffset + atOffset + offset ;
307
312
}
308
313
}
@@ -345,4 +350,4 @@ if ( $.uiBackCompat !== false ) {
345
350
} ( jQuery ) ) ;
346
351
}
347
352
348
- } ( jQuery ) ) ;
353
+ } ( jQuery ) ) ;
0 commit comments