Skip to content

Commit c660d67

Browse files
committed
Position: Remove at-center guards, take at:center into account instead. Fixes #8127 - collision:flip should be supported for at:center
1 parent db72cb7 commit c660d67

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

ui/jquery.ui.position.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -358,10 +358,6 @@ $.ui.position = {
358358
},
359359
flip: {
360360
left: function( position, data ) {
361-
if ( data.at[ 0 ] === "center" ) {
362-
return;
363-
}
364-
365361
var within = data.within,
366362
withinOffset = within.offset.left + within.scrollLeft,
367363
outerWidth = within.width,
@@ -377,7 +373,9 @@ $.ui.position = {
377373
0,
378374
atOffset = data.at[ 0 ] === "left" ?
379375
data.targetWidth :
380-
-data.targetWidth,
376+
data.at[ 0 ] === "right" ?
377+
-data.targetWidth :
378+
0,
381379
offset = -2 * data.offset[ 0 ],
382380
newOverRight,
383381
newOverLeft;
@@ -396,10 +394,6 @@ $.ui.position = {
396394
}
397395
},
398396
top: function( position, data ) {
399-
if ( data.at[ 1 ] === "center" ) {
400-
return;
401-
}
402-
403397
var within = data.within,
404398
withinOffset = within.offset.top + within.scrollTop,
405399
outerHeight = within.height,
@@ -415,7 +409,9 @@ $.ui.position = {
415409
0,
416410
atOffset = data.at[ 1 ] === "top" ?
417411
data.targetHeight :
418-
-data.targetHeight,
412+
data.at[ 1 ] === "bottom" ?
413+
-data.targetHeight :
414+
0,
419415
offset = -2 * data.offset[ 1 ],
420416
newOverTop,
421417
newOverBottom;

0 commit comments

Comments
 (0)