Skip to content

Commit 7f808b2

Browse files
committed
Position: Check to also make sure to only flip if more of the element is inside "within"
1 parent 8274f08 commit 7f808b2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ui/jquery.ui.position.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ $.ui.position = {
376376
newOverBottom;
377377
if ( overTop < 0 ) {
378378
newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset;
379-
if ( newOverBottom < 0 || newOverBottom < Math.abs( overTop ) ) {
379+
if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < Math.abs( overTop ) ) ) {
380380
data.elem
381381
.addClass( "ui-flipped-bottom" );
382382

@@ -385,7 +385,7 @@ $.ui.position = {
385385
}
386386
else if ( overBottom > 0 ) {
387387
newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - withinOffset;
388-
if ( newOverTop > 0 || Math.abs( newOverTop ) < overBottom ) {
388+
if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || Math.abs( newOverTop ) < overBottom ) ) {
389389
data.elem
390390
.addClass( "ui-flipped-top" );
391391

0 commit comments

Comments
 (0)