Skip to content

Commit

Permalink
Position: Check to also make sure to only flip if more of the element…
Browse files Browse the repository at this point in the history
… is inside "within"
  • Loading branch information
kborchers committed Sep 16, 2011
1 parent 8274f08 commit 7f808b2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ui/jquery.ui.position.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ $.ui.position = {
newOverBottom;
if ( overTop < 0 ) {
newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset;
if ( newOverBottom < 0 || newOverBottom < Math.abs( overTop ) ) {
if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < Math.abs( overTop ) ) ) {
data.elem
.addClass( "ui-flipped-bottom" );

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

Expand Down

0 comments on commit 7f808b2

Please sign in to comment.